a = input()
for i in range(len(a)):
    if a[i] == " ":
        a1 = int(a[0:i])
        a2 = int(a[i+1:])
d = 0
for i in range(a1):
    c = input()
    c1 = int(c[0])+int(c[2])
    d += c1
if a2 >= d:
    print(a2)
else:
    print(d)