n, k = input().split(" ")n = int(n)k = int(k)sum = 0for i in range(k): t = input() sum += int(t)print(sum)if sum <= n*(k-1): print(0)else: print(sum-n*(k-1))
1000000000 2 800000000 800000000
1600000000 600000000
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!