n, k = map(int, input().split())
a = list(map(int, input().split()))
if k == 1:
    print(a(max))
else:
    sum_a = []
    anslist = []
    for i in range(n):
        sum_a.append(sum(a[0:i+1]))
    if i >= k-1:
        anslist.append(sum_a[i] - sum_a[i-k])
    print(sum_a)
    print(anslist)
    print(max(anslist))