Go: package main

import "fmt"

func main() {

	for true {
		var n, k int
		fmt.Scan(&n, &k)

		if n == 0 && k == 0 {
			return
		}
		
		a := make([]int, n)
		ans := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scan(&a[i])
			if i == 0 {
				ans[i] = a[i]
			} else {
				ans[i] = ans[i-1] + a[i]
			}
		}
		max := 0
		for i := k; i < n; i++ {
			t := ans[i] - ans[i-k]
			if max < t {
				max = t
			}
		}
		fmt.Println(max)
	}
}

Python: while True:
    n,k=map(int,(input().split()))
    if n==0 and k==0:
        break
    a,b,s=[],[],0
    for i in range(n):
        a.append(int(input()))
        if i==k-1:
            s=sum(a[0:k])
        elif i>=k:
            s=s+a[i]-a[i-k]
        b.append(s)
    print(max(b))

Python: while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    x=[]
    for i in range(n):
        x.append(int(input()))
    s=sum(x[0:k])
    max=s
    for i in range(k,n):
        s=int(s+x[i]-x[i-k])
        if max<s:
            max=s
    print(max)

Python: while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    a=[int(input()) for _ in range(n)]
    s=sum(a[0:k])
    ss=[s]
   
    for i in range(k,n):
        s=s+a[i]-a[i-k]
        ss.append(s)
        
    print(max(ss))

Python: # coding: utf-8
# Your code here!

try:
   while True:
      n, k = map(int, input().split())
      if n + k == 0:
         break
      
      l = []
      for i in range(n):
         l.append(int(input()))

      s1 = 0
      for i in range(k):
         s1 += l[i]
      
      ma = 0
      s2 = 0
      for j in range(n - k):
         s2 = s1 - l[j] + l[j + k]
         if s2 > ma:
            ma = s2
         s1 = s2
      print(ma)

except EOFError:
   pass

Python: from itertools import accumulate
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def solve():
    N, K = map(int, input().split())
    if N == 0:
        exit()
    A = [int(input()) for _ in range(N)]
    S = sum(A[:K])

    ans = S
    for i in range(K, N):
        S = S-A[i-K]+A[i]
        ans = max(ans, S)
    print(ans)


def solve2():
    N, K = map(int, input().split())
    if N == 0:
        exit()
    else:
        A = [int(input()) for _ in range(N)]
        A = [0]+list(accumulate(A))
        ans = max([A[i+K]-A[i] for i in range(N-K)])
        print(ans)


while True:
    solve2()

Python: def calc(n, k):
	a = [int(input()) for _ in range(n)]
	s = [0] * (n + 1)
	for i in range(n):
		s[i + 1] = s[i] + a[i]
	ans = float('-inf')
	for i in range(n-k+1):
		ans = max(ans, s[k+i] - s[i])
	print(ans)

def resolve():
	while True:
		n, k = map(int, input().split())
		if n == 0 and k == 0:
			return
		calc(n, k)
resolve()

Python: for v in range(5):
    n, k = map(int, input().split())
    if n == 0 and k == 0:
        break
    a = [int(input()) for i in range(n)]
    sum = []
    s = [0] * n

    for i in range(n-1):
        s[i+1] = s[i] + a[i]

    for i in range(n-k):
        sum.append(s[i+k] - s[i])

    print(max(sum))

Python: while True:
    n, k = [int(i) for i in input().split()]
    if n == 0 and k == 0:
        break
    a = [int(input()) for i in range(n)]
    s = sum(a[0:k])
    max = s
    for i in range(k, n):
        s = s + a[i] - a[i - k]
        if s > max:
            max = s
    print(max)

Python: 
while True:
    n,k=map(int,input().split())
    if n == 0 and k == 0:break
    a=[int(input())for _ in range(n)]
    s=sum(a[0:k])
    ss=[s]
    for i in range(k,n):
        s=s+a[i]-a[i-k]
        ss.append(s)
    print(max(ss))

Python: # coding: utf-8
# Your code here!

while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    a=[int(input()) for _ in range(n)]
    s=sum(a[0:k])
    ss=[s]
    for i in range(k,n):
        s=s+a[i]-a[i-k]
        ss.append(s)
    print(max(ss))

Python: n,k = map(int,input().split())
a = [int(input()) for i in range(n)]

unko = [0]
for i in range(n):
        unko.append(unko[i]+a[i])
mvl = 0
for i in range(n-k+1):
        if unko[i+k]-unko[i] >= mvl:
                mvl = unko[i+k]-unko[i]
print(mvl)

Python: while True :
    n, m = map(int, input().split())
    if m == 0 and n == 0 :
        break
    
    List = []
    max_ans = 0
    sum_ans = 0
    for i in range(n) :
        List.append(int(input()))
        if i < m : 
            sum_ans += List[i] 
        else : 
            sum_ans += List[i] - List[i-m]
        if i >= m - 1 and max_ans < sum_ans :
            max_ans = sum_ans
    print(max_ans)

Python: while True:
    a, b = map(int, input().split(" "))
    if a == 0 & b == 0:
        break
    li1 = []
    for i in range(0, a):
        li1.append(int(input()))
    max = 0
    for n in range(0, a + 1 - b):
        sum = 0
        for n1 in range(n, n + b):
            sum = sum + li1[n1]
        if max < sum:
            max = sum
    print(sum)

Python: while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    a = []
    for i in range(n):
        a.append(int(input()))
        count = 0
    for i in range(k):
        count += a[i]
        ans = count
    for i in range(k, n):
        count += a[i]
        count -= a[i - k]
        ans = max(ans, count)
    print(ans)

Python: # coding: utf-8
# 48

while True:
    
    n,k = map(int,input().split())
    if n==0 and k==0:
        break
    
    a=[]
    cnt=0
    S=[]
    s=0
    
    
    for i in range(n):
        a.append(int(input()))
    
    S.append(sum(a[0:k]))
    
    for i in range(k,n):
        s = S[cnt]-a[i-k]+a[i]
        S.append(s)
        cnt += 1
        
    print(max(S))

Python: while True :
    n, k = map(int, input().split())
    
    if n == 0 :
        break
    else :
        A = []
        S = []
        s = 0
        cnt = 0
        
        for i in range(n) :
            A.append(int(input()))
            
        for i in range(k) :
            s += A[i]
        S.append(s)
            
        for j in range(k, n) :
            s = S[cnt] - A[j - k] + A[j]
            S.append(s)
            cnt += 1
        
        print(max(S))

Python: def main():
    while 1:
        maximum = 0
        n,k = map(int,input().split())
        if not n and not k: break
        N = [int(input())for _ in range(n)]
        for i in range(n-k+1):
            maximum = max(maximum,sum(N[i:i+k]))
        print(maximum)
if __name__ == "__main__":
    main()

Python: while True:
    n, k = map(int, input().split())
    if n == k == 0:
        break
    a_sum = [0]
    now = 0
    for i in range(n):
        now += int(input())
        a_sum.append(now)
    maximum = a_sum[k]-a_sum[0]
    for i in range(n-k):
        maximum = max(a_sum[k+i]-a_sum[i], maximum)
    print(maximum)

Python: while True:
    n, k = map(int,input().split())
    a = []
    if n==0 and k==0:
        break
    for i in range(n):
        a.append(int(input()))
    b = sum(a[0:k])
    c = b
    for i in range(k,n):
        b = b + a[i] - a[i-k]
        if b > c:
            c = b
    print(c)

Python: while True:
    n,k=map(int,input().split())
    if (n,k)==(0,0):
        break
    lst=[int(input()) for i in range(n)]
    a=[]
    c=0
    for i in range(k):
        c+=lst[i]
    a.append(c)
    for j in range(n-k):
        c+=lst[k+j]
        c-=lst[j]
        a.append(c)
    print(max(a))

Python: n,k = [int(i) for i in input().split()]
a = [int(input()) for i in range(n)]
b = [0]*len(a)

for i in range(n):
    b[i] = b[i-1] + a[i]
b = b + [0]

c = [b[i + k - 1] - b[i - 1] for i in range(n - k + 1)]

print(max(c))

Python: while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    sn=[]
    for i in range(n):
        sn.append(int(input()))
    c=[]
    for j in range(0,n-k+1):
        if j==0:
            fsum = sum(sn[0:k])
        else:
            fsum = fsum + sn[j+k-1] - sn[j-1]
        c.append(fsum)
    print(max(c))