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

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

Python: while True:
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    x=[]
    for i in range(n):
        x.append(int(input()))
    s=sum(x[0:k])
    max=s
    for i in range(k,n):
        s=int(s+x[i]-x[i-k])
        if max<s:
            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: # coding: utf-8
# Your code here!

try:
   while True:
      n, k = map(int, input().split())
      if n + k == 0:
         break
      
      l = []
      for i in range(n):
         l.append(int(input()))

      s1 = 0
      for i in range(k):
         s1 += l[i]
      
      ma = 0
      s2 = 0
      for j in range(n - k):
         s2 = s1 - l[j] + l[j + k]
         if s2 > ma:
            ma = s2
         s1 = s2
      print(ma)

except EOFError:
   pass

Python: from itertools import accumulate
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def solve():
    N, K = map(int, input().split())
    if N == 0:
        exit()
    A = [int(input()) for _ in range(N)]
    S = sum(A[:K])

    ans = S
    for i in range(K, N):
        S = S-A[i-K]+A[i]
        ans = max(ans, S)
    print(ans)


def solve2():
    N, K = map(int, input().split())
    if N == 0:
        exit()
    else:
        A = [int(input()) for _ in range(N)]
        A = [0]+list(accumulate(A))
        ans = max([A[i+K]-A[i] for i in range(N-K)])
        print(ans)


while True:
    solve2()

Python: def calc(n, k):
	a = [int(input()) for _ in range(n)]
	s = [0] * (n + 1)
	for i in range(n):
		s[i + 1] = s[i] + a[i]
	ans = float('-inf')
	for i in range(n-k+1):
		ans = max(ans, s[k+i] - s[i])
	print(ans)

def resolve():
	while True:
		n, k = map(int, input().split())
		if n == 0 and k == 0:
			return
		calc(n, k)
resolve()

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

    for i in range(n-1):
        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: 
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==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: 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])
mvl = 0
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, m = map(int, input().split())
    if m == 0 and n == 0 :
        break
    
    List = []
    max_ans = 0
    sum_ans = 0
    for i in range(n) :
        List.append(int(input()))
        if i < m : 
            sum_ans += List[i] 
        else : 
            sum_ans += List[i] - List[i-m]
        if i >= m - 1 and max_ans < sum_ans :
            max_ans = sum_ans
    print(max_ans)

Python: while True:
    a, b = map(int, input().split(" "))
    if a == 0 & b == 0:
        break
    li1 = []
    for i in range(0, a):
        li1.append(int(input()))
    max = 0
    for n in range(0, a + 1 - b):
        sum = 0
        for n1 in range(n, n + b):
            sum = sum + li1[n1]
        if max < sum:
            max = sum
    print(sum)

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

Python: # coding: utf-8
# 48

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