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=[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: while True:
    n,k = map(int,input().split(" "))
    if n == 0 and k == 0:
        break
    else:
        nums = [int(input()) for _ in range(n)]
        ruiseki = [0] * (n + 1)
        for i,num in enumerate(nums):
            ruiseki[i + 1] = ruiseki[i]  + num
        # print(ruiseki)
        ans = - (10 ** 15)
        for left in range(n - k):
            ans = max(ans, ruiseki[left + k] - ruiseki[left])
        print(ans)

Python: while 1:
    n,k = [int(i) for i in input().split()]
    if not n and k:
        break
    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: #aとbが0のとき処理を終わる
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 l in range(b,a):
        i += line[l] - line[l - b]
        kei.append(i)
        
    #出力
    print(max(kei))

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])
inf = float("inf")*(-1)
mvl = inf
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, 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: while True:
    n,k = map(int,input().split())
    if n==0 and k==0:
        break
    else:
        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: import sys
A = True
while A:
  n, k = map(int,input().split())
  if n == 0 and k == 0:
    break

  S = [-1 for _ in range(n)]
  for i in range(n):
    temp = int(input())
    if i == 0:
      S[i] = temp
    else:
      S[i] = S[i-1]+temp

  ans = S[k-1]
  for i in range(n-k): #0かあn-k-1まで。
    temp = S[i+k]-S[i]
    ans = max(ans,temp)
  print(ans)

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

    s = [0]
    for i in range(n):
        s.append(s[i] + a[i])

    m = 0
    for i in range(1, n - k + 1):
        m = max(m, s[i + k] - s[i])

    print(m)

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: 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: def main():
    while True:
        a,b=map(int,input().split())
        
        if a==0 and b==0:
            break
        l=[]
        for i in range(a):
            l.append(int(input()))
        count=0
        
        for i in range(b):
            count+=l[i]
        anser=count
        
        for i in range(b,a):
            count+=l[i]
            count-=l[i-b]
            anser=max(anser,count)
        print(anser)
        
if __name__ == '__main__':
    main()

Python: while True:
    n,k=map(int,input().split())
    a=[]
    if n==0 and k==0:
        break
    for _ in range(n):
        a.append(int(input()))
    
    s=[0 for _ in range(n+1)]
    for i in range(n):
        s[i+1]=s[i]+a[i]
    ans=0
    for i in range(n-k):
        ans=max(ans,s[i+k]-s[i])
    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: 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: 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: while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    else:
        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 func(n,k):
    A = []
    ans = 0
    SUM = 0
    for i in range(n):
        A.append(int(input()))
    for i in range(k-1):
        SUM += A[i]
    for i in range(k,len(A)):
        ans = max(ans,SUM+A[i]-A[i-k])
    print(ans)

for i in range(10):
    n,k = [int(s) for s in input().split()]
    if n == 0 and k ==0:
        break
    else:
        func(n,k)

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: while True:
    n,k=map(int,input().split())
    if (n,k)==(0,0):
        break
    a=[int(input()) for i in range(n)]
    b=sum(a[0:k])
    c=[b]
    for i in range(n-k):
        b+=a[i+k]-a[i]
        c.append(b)
    print(max(c))

Python: import sys

readline = sys.stdin.readline

def main():
    while True:
        n, k = map(int, readline().split())
        if n == 0 and k == 0:
            return
        a = []
        for _ in range(n):
            a.append(int(readline()))

        base = sum(a[:k])
        subsum = [base]
        for i in range(k,n):
            base += a[i]
            base -= a[i-k]
            subsum.append(base)

        print(max(subsum))


if __name__ == "__main__":
    main()

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))