def dinner(n,a):
    t=0
    for i in range(n):
        b=int(input())
        c=int(input())
        t+=(b+c)
    if t>a:
        print(t)
    else:
        print(a)
n=int(input())
a=int(input())
dinner(n,a)

