import sys
input = sys.stdin.readline
N, C = map(int, input().split())
lst = [int(input()) for _ in range(N)]
interval_sum = sum(lst[:C])
ans = interval_sum
for i in range(N-C):
interval_sum += lst[i+C] - lst[i]
ans = max(ans, interval_sum)
print(ans)