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: 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+1)

    for i in range(n):
        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: x=[]
y=[]
while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    else:
        x=[int(input()) for i in range(n)]
        if len(x)<k:
            pass
        else:
            s=sum(x[0:k])
            y.append(s)
            for i in range(0,n-k):
                s=s-x[i]+x[i+k]
                y.append(s)
            print(max(y))

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

Python: from itertools import accumulate

# 区間[N-k, N) の総和の最大値

while True:
  n, k = map(int, input().split(" "))
  if n == 0:
    break
  a_n = [int(input()) for _ in range(n)]
  _ = input()

  a_n = list(accumulate(a_n))
  # print(a_n)

  result = -99999999999999

  for i in range(n-k):
    val = a_n[k+i] - a_n[i]
    if result < val:
      result = val


  print(result)

Python: a = [0]*10**5
while 1:
    n,k = map(int, raw_input().split())
    if n==0 and k==0: break
    for i in range(n): a[i] = int(raw_input())
    S = sum(a[0:k]); ans = 0;
    for i in range(n-k):
        ans = max(ans, S)
        S += a[k+i]-a[i]
    print(str(ans))

Python: def fun(n, k):
    A = []
    total = 0
    for _ in range(n):
        a = int(input())
        total += a
        A.append(total)
    maximam = A[k-1]
    for num, a in zip(range(k,n), A[k:]):
        maximam = max(maximam, A[num] - A[num - k])
    print(maximam)

for _ in range(5):
    n, k = map(int, input().split())
    if n == 0 and k == 0:
        break
    else:
        fun(n, k)

Python: while 1:
    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])
    M = s
    
    for i in range(k, n):
        s = s + a[i] - a[i - k]
        if s > M:
            M = s
            
    print(M)

Python: 
a, s = [0]*100003, [0]*100003
while True:
	n, k = map(int, input().split())
	if n == 0: break
	s[0] = a[0] = int(input())
	for i in range(1, n):
		a[i] = int(input())
		s[i] = s[i-1] + a[i]
		if i >= k: s[i] -= a[i-k]
	ans = s[k-1]
	for i in range(k, n):
		if s[i] > ans: ans = s[i]
	print(ans)

Python: while True:
    n, k = map(int, input().split())
    if n == 0 and k == 0: break
    a = [int(input()) for i 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: from itertools import accumulate

# 区間[N-k, N) の総和の最大値


n, k = map(int, input().split(" "))
a_n = [int(input()) for _ in range(n)]
_ = input()

a_n = list(accumulate(a_n))
# print(a_n)

result = -99999999999999

for i in range(n-k):
  val = a_n[k+i] - a_n[i]
  if result < val:
    result = val


print(result)

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

Python: while True:
    a,b=map(int,input().split())
    if a==0 and b==0: break

    line=[]
    kei=[]
    i=0
    
    for _ in range(a):line.append(int(input()))
    
    for j in range(0,b):i += line[j]
    
    for I in range(b,a):
        i += line[I]-line[I-b]
        kei.append(i)
        
    print(max(kei))

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

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

    s = [0 for i in range(n+1)]
    # 累積和配列の生成
    for i in range(n):
        s[i+1] = s[i] + a[i]

    ans = -float("inf")
    for i in range(n-k):
        ans = max(ans, s[i+k] - s[i])

    print(ans)

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: def solve(n,k,a):
    S=[0]*(n+1)
    S[0]=a[0]
    for i in range(0,n):
        S[i+1]=S[i]+a[i]
    ans=-S[k-1]
    for i in range(0,n-k+1):
        if ans<S[i+k]-S[i]:
            ans=S[i+k]-S[i]
    return ans
n,k=map(int,input().split())
while n>0:
    a=[int(input()) for _ in range(n)]
    ans=solve(n,k,a)
    print(ans) 
    n,k=map(int,input().split())

Python: import sys
def mips():
    return map(int,input().split())
def ii():
    return int(input())
#AOJ_maximum sum
def procedure():
    N,K = mips()
    if N == 0:
        sys.exit(0)
    A = []
    res = -(10**100)
    for _ in range(N):
        a = ii()
        A.append(a)
    S = [0]
    for i in range(N):
        s = S[i] + A[i]
        S.append(s)
    for i in range(N-K):
        res = max(res,S[i+K]-S[i])
    print(res)
while True:
    procedure()

Python: from queue import deque

while True:
    n, k = map(int, input().split())
    if not n:
        break
    q = deque(int(input()) for _ in range(k))
    ans = sum(q)
    for _ in range(n - k):
        new = int(input())
        q.append(new)
        old = q.popleft()
        if new > old:
            ans += new - old
    print(ans)

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+k==0:
        break
    a=[int(input()) for i 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: 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
    else:
        x=[]
        x=[int(input()) for i in range(n)]
        l=len(x)
        b=[]
        if l<k:
            pass
        else:
            s=sum(x[0:k])
            b.append(s)
            for j in range(n-k):
                s=s-x[j]+x[j+k]
                b.append(s)
        m=max(b)
        print(m)

Python: import itertools
while True:
    N, K = map(int, input().split())
    if N==K==0:
        break
    S = [int(input()) for _ in range(N)]
    
    Scum = [0] + list(itertools.accumulate(S))
    reg = -10**9
    for i in range(N-K+1):
        partial_sum = Scum[i+K] - Scum[i]
        reg = max(reg, partial_sum)
    print(reg)