n, m = map(int, input().split()) c = list(map(int, input().split())) c.sort() i = 0 cnt = 0 while cnt < m: if c[i] > 0: c[i] -= 1 cnt += 1 else: i += 1 ans = 0 for ci in c: if ci == 0: ans += 1 print(ans)