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 = map(int,input().split())
         if n == 0:
                  break
         a = [int(input()) for i in range(n)]
         s = [0]
         for i in range(n):
                  s.append(a[i]+s[i])
                  ans = 0
         for i in range(len(s) - k):
                  if ans < s[i + k] - s[i]:
                           ans = s[i + k] - s[i]
         print(ans)

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

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

Python: #!/usr/bin/env python3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")

# https://onlinejudge.u-aizu.ac.jp/courses/library/3/DSL/all/DSL_1_B
import sys
sys.setrecursionlimit(1000000)
INF = float("inf")

while True:
    N,K = map(int,sys.stdin.readline().split())
    if N==0 and K==0:
        exit()
    a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param

    com = [0]*(N+1)
    for i in range(N):
        com[i+1]=com[i]+a[i]

    ret = -INF
    for i in range(N-K):
        ret = max(ret,com[i+K]-com[i])
    print(ret)

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

Python: while 1:
    n,m=map(int,input().split())
    if n==m==0:break
    li=[]
    for i in range(n):
        li.append(int(input()))
    s_li=[li[0]]
    for i in range(1,n):
        s_li.append(s_li[-1]+li[i])
    c_li=[s_li[m-1]]
    for i in range(n-m):
        c_li.append(s_li[i+m]-s_li[i])
    print(max(c_li))

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 1:
    n,m=map(int,input().split())
    if n==m==0:break
    li=[]
    for i in range(n):
        li.append(int(input()))
    s_li=[li[0]]
    for i in range(1,n):
        s_li.append(s_li[-1]+li[i])
    c_li=[s_li[m-1]]
    for i in range(n-m):
        c_li.append(s_li[i+m]-s_li[i])
    print(max(c_li))

Python: def main():
    from itertools import accumulate
    N, K = (int(i) for i in input().split())
    while N != 0 or K != 0:
        A = [int(input()) for i in range(N)]
        S = list(accumulate([0] + A))
        ans = 0
        for i in range(N-K+1):
            cur = S[i+K] - S[i]
            ans = max(ans, cur)
        print(ans)
        N, K = (int(i) for i in input().split())


if __name__ == '__main__':
    main()

Python: while True:
    
    n,k = map(int,input().split())
    if n == k == 0:
        break
    N_lis = []
    for i in range(n):
        N_lis.append(int(input()))
    N_max = 0
    N_sum = 0
    for j in range(k):
        N_sum += N_lis[j]
    for l in range(n - k):
        if N_sum - N_lis[l] + N_lis[l + k] > N_sum:
            N_max = N_sum - N_lis[l] + N_lis[l + k]
        N_sum = N_sum - N_lis[l] + N_lis[l + k]
    print(N_max)

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=0
	for i in range(k, n):
		if s[i] > ans:
		    ans = s[i]
	print(ans)

Python: #!/usr/bin/env python3

import sys

sys.setrecursionlimit(10**7)


def read_h(typ=int):
    return list(map(typ, input().split()))


def read_v(n, m=1, typ=int):
    return [read_h(typ) if m > 1 else typ(input()) for _ in range(n)]


def solve():
    n, k = read_h()
    arr = read_v(n)

    cumul = [sum(arr[:i]) for i in range(len(arr) + 1)]
    #  print(cumul)

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

    print(ans)


def main():
    while True:
        n, k = read_h()
        if (n, k) == (0, 0):
            break

        arr = read_v(n)

        cumul = [0]
        for i in range(n):
            cumul.append(cumul[i] + arr[i])

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

        print(ans)


if __name__ == '__main__':
    main()

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])
 max = s

 for i in range(k,n):
  s = s+a[i]-a[i-k]
  if s > max: max = s
 
 print(max)

Python: import sys
input = sys.stdin.readline
from operator import itemgetter
sys.setrecursionlimit(10000000)
INF = 10**30

def main():
    while True:
        n, k = list(map(int, input().strip().split()))
        if n == 0 and k == 0:
            return
        v = [0] * n
        a = [0] * (n+1)
        for i in range(n):
            v[i] = int(input().strip())
        for i in range(n):
            a[i+1] = v[i] + a[i]

        ans = -INF
        for i in range(n-k+1):
            ans = max(ans, a[i+k] - a[i])
        print(ans)

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

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

Python: from itertools import accumulate

while True:
    N, K = map(int, input().split())
    if N == 0:
        break
    A = [int(input()) for _ in range(N)]

    S = list(accumulate([0] + A))
    ans = max(S[i] - S[i-K] for i in range(K, len(S)))
    print(ans)