na = input()
n = na[0]
a = na[1]
a = int(a)
n = int(n)
d = 0
for i in range(n):
    bc = input()
    b = bc[0]
    c = bc[1]
    b = int(b)
    c = int(c)
    d += b
    d += c
e = a + n
if d > e:
    print(d)
elif e > d:
    print(e)