
n,a=input().split()
n,a=int(n),int(a)
for i in range(n):
    b,c=input().split()
    b,c=int(b),int(c)
s=0
s=int(s)
s=b+c
if s>a:
    print(s)
else:
    print(a)







































































