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: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0516

"""
import sys
from sys import stdin
from collections import deque
input = stdin.readline


def main(args):
    while True:
        n, k = map(int, input().split())
        if n == 0 and k == 0:
            break

        d = deque([int(input()) for _ in range(k)])
        sum_value = sum(d)
        maximum_sum = sum_value

        for _ in range(n-k):
            v = int(input())
            o = d.popleft()
            sum_value = sum_value - o + v
            if sum_value > maximum_sum:
                maximum_sum = sum_value
            d.append(v)

        print(maximum_sum)


if __name__ == '__main__':
    main(sys.argv[1:])

Python: while True :
    x,y=input().split()
    x=int(x)
    y=int(y)
    if x==y==0 : break
    a=[]
    c=0
    for i in range(x) :
        b=input()
        a.append(int(b))
    for i in range(y) : 
        c=c+a[i]
        ans=c
    for i in range(y,x) :
        c=c+a[i]-a[i-y]
        ans=max(ans,c)
    print(ans)

Python: def func(n,k):
    A = []
    ans = 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(100):
    n,k = [int(s) for s in input().split()]
    if n == 0 and k ==0:
        break
    else:
        func(n,k)

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

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

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

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)