N, D = map(int, input().split()) a = list(map(int, input().split())) d = [0] for i in range(N-1): d.append(d[-1]+a[i]) ans = [0] for di in d[1:]: if di-ans[-1]