a=[]
b=input()
b=b.split(" ")
for i in range(int(b[0])):
    c=input()
    c=c.split(" ")
    a.append(c)
n=0
for i in a:
    n+=int(i[0])+int(i[1])
if n>=int(b[1]):
    print(n)
else:
    print(int(b[1]))
