输入数据:
5 3
4 4 1 2 1
n, m = map(int, input().split())
w = [int(0)*(n+1)]
s = [int(0)*(m+1)]
w = list(map(int, input().split()))
for i in range(1,n+1):
maxx = 1
for j in range(2, m+1):
if s[maxx] > s[j]:
maxx = j
s[maxx] += w[i-1]
maxx = 1
j = 0
for j in range(1,m+1):
if s[j] > maxx:
maxx = s[i]
else:
continue
print(maxx)