m = 0
n = input()
n = n.spilt(" ")
n = int(n)
for i in range(n[0]):
    w = input()
    w = w.spilt(" ")
    w = int(w)
    for i in w:
        m += i
if m < n[1]:
    print(m + n[1])
else:
    print(m)