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 main():
	while True:
		a = []
		n, k = [int(x) for x in input().split()]
		if n == 0 and k == 0: break
		for i in range(n): a.append(int(input()))
		l = [0]
		for i in range(1, n - k + 1): l.append(a[i + k - 1] - a[i - 1])
		maxsum = 0
		maxi = 0
		s = 0
		for i, x in enumerate(l):
			s += x
			if s >= maxsum:
				maxsum = s
				maxi = i
		print(sum(a[i - 1:i + k - 1]))
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: def resolve():
    N, M = [int(i) for i in input().split()]
    while N + M != 0:
        A = [int(input()) for _ in range(N)]
        preSum = [0] * (N + 1)
        for i in range(N):
            preSum[i + 1] = preSum[i] + A[i]
        maxA = -10000 * M - 1
        for i in range(M, N):
            maxA = max(maxA, preSum[i] - preSum[i - M])
        print(maxA)
        N, M = [int(i) for i in input().split()]


resolve()

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

Python: if __name__ == '__main__':
    [n, k] = [int(i) for i in input().split()]
    a = []
    for i in range(n):
        a.append(int(input()))

    old = sum(a[0:k])
    max = old

    for i in range(1, n-k+1):
        new = old - a[i-1] + a[i+k-1]
        if new > max:
            max = new
        old = new

    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
    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 main():
	while True:
		a = []
		n, k = [int(x) for x in input().split()]
		if n == 0 and k == 0: break
		for i in range(n): a.append(int(input()))
		l = [0]
		for i in range(1, n - k + 1): l.append(a[i + k - 1] - a[i - 1])
		maxsum = 0
		maxi = 0
		s = 0
		for i, x in enumerate(l):
			s += x
			if s >= maxsum:
				maxsum = s
				maxi = i
		print(sum(a[maxi:maxi + k]))
main()

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

    list1 = []
    try:
        for i in range(n):
            num = 0
            for j in range(k):
                num += a[i + j]
            list1.append(num)
    except:
        pass

    print(max(list1))

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

    a = [0]*n
    for i in range(n):
        a[i] = int(input())

    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)

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

Python: while(1):
    n,k=map(int,input().split())
    if n==0 and k==0:
        break
    else:
        s=[0]*(n+1)
        top=0
        for i in range(1,n+1):
            b=int(input())
            
            s[i]=s[i-1]+b

        for i in range(n-k+1):
            v=s[k+i]-s[i]
            if v>top:
                top=v
        print(top)

Python: while True:
    n,m=map(int,input().split())
    if n==m==0:break
    alist = []
    for i in range (n):
        a=int(input())
        alist.append(a)
    s = sum(alist[0:m])   #a[i:j]→[a[i], a[i+1], a[i+2], ..., a[j-1]]
    max = s
    for i in range(m, n):
        s = s + alist[i] - alist[i - m]
        if s > max:
            max = s
    print(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 k==0 and n==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 1:
    n , o = map(int, input().split())
    if n == 0 and o == 0:break
    else:
        k = [0]
        for i in range(n):
            k.append(k[-1]+int(input()))
        m = -float("INF")
        for i,l in zip(k,k[o:]):
            m = max(m,l-i)
        print(m)

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 = 0
    s = [0]*(n+1)
    
    for i in range(n):
        s[i+1]=s[i]+a[i]
        
    for i in range(n-k+1):
        tmp = s[k+i]-s[i]
        if tmp>b:
            b = tmp

    print(b)

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

        old = sum(a[0:k])
        max = old

        for i in range(1, n-k+1):
            new = old - a[i-1] + a[i+k-1]
            if new > max:
                max = new
            old = new

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