https://blog.youkuaiyun.com/weixin_47243236/article/details/122775971#comments_21461297
Python解法
N = int(input())
M = int(input())
arr = sorted(list(map(int, input().split(' '))))
res = 0
tmp = 0
for each in arr:
res += 1
if each + tmp > N:
tmp -= N - each
else:
tmp = 0
res += (tmp + 1) // N
print(res)