N, K = map(int, input().split())
L = list(map(int, input().split()))

d = [sum(L[0:K])]
for i in range(N-K):
    d += [d[i] - L[i] + L[i+K]]
c = 0
for i in range(N-K+1):
    if d[i] > d[c] : c = i

print(max(0, sum(L[x] for x in range(N) if L[x] > 0 or (x >= c and x < c+K))))
