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