Go: package main

import (
	"bufio"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	parseProblem(os.Stdin)
}

func parseProblem(r io.Reader) {
	const (
		initialBufSize = 100000
		maxBufSize     = 1000000
	)
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords) // bufio.ScanLines
	for true {
		n, k := scanInt(sc), scanInt(sc)
		if n == 0 && k == 0 {
			break
		}
		sum := make([]int, n+2)
		for i := 2; i <= n+1; i++ {
			sum[i] = sum[i-1] + scanInt(sc)
		}
		max := math.MinInt32
		for i := 1; i+k <= n+1; i++ {
			if v := sum[i+k] - sum[i]; max < v {
				max = v
			}
		}
		fmt.Println(max)
	}
	return
}

func resolve(n int) int {
	return n
}

// snip-scan-funcs
func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return int(i)
}
func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

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

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: 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 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=[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))