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

Python: def func(n,k):
    SUM = 0
    ans = 0
    A = [int(input()) for _ in range(n)]
    for i in range(k):
        SUM += A[i]
    for i in range(k,len(A)):
        ans = max(ans,SUM+A[i]-A[i-k])
        SUM = SUM+A[i]-A[i-k]
    print(ans)

for _ in range(10):
    n,k = [int(s) for s in input().split()]
    if n == 0 and k ==0:
        break
    else:
        func(n,k)

Python: n , o = map(int, input().split())
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: # coding: utf-8
# Your code here!

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 = [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(x) for x 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: def main():
  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)

if __name__ == '__main__':
  main()

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])
        ans = old

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

        print(ans)

Python: from collections import deque
while True:
    n, k = map(int, input().split())
    if n==0:break
    a = deque(int(input()) for _ in range(k))
    ans=tmp=sum(a)
    for _ in range(n-k):
        x = a.popleft()
        y = int(input())
        a.append(y)
        tmp += y - x
        ans = max(ans, tmp)
    print(ans)

Python: def solve():
    while 1:
        n, k = [int(_) for _ in input().split()]
        if n == 0: return

        A = [int(input()) for _ in range(n)]
        s = [0] * (len(A) + 1)
        for i in range(n):
            s[i + 1] = s[i] + A[i]

        ans = -1
        for l in range(n):
            r = l + k
            if r > n: break
            ans = max(ans, s[r] - s[l])
        print(ans)


if __name__ == '__main__':
    solve()

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

Python: from queue import deque

while True:
    n, k = map(int, input().split())
    if not n:
        break
    q = deque(int(input()) for _ in range(k))
    ans = cur = sum(q)
    for _ in range(n - k):
        new = int(input())
        q.append(new)
        old = q.popleft()
        cur += new - old
        ans = ans if ans > cur else cur
    print(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 = [int(input()) for _ in range(n)]
    s = sum(a[0:k])
    l = [s]
    for i in range(k,n):
        s = s + a[i] - a[i-k]
        l.append(s)
    print(max(l))

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

Python: while 1:
  s=input()
  N, K = map(int, s.split(' '))
  if N == 0 and K == 0:
    break
  a = []
  for _ in range(N):
    a.append(int(input()))
  s = [0]
  for i, n in enumerate(a):
    s.append(n + s[i])

  ans = 0
  for i, n in enumerate(s):
    if i - K >= 0:
      ans = max(ans, s[i] - s[i-K])
  print(ans)

Python: while True:
    n,m=map(int,input().split())
    if n==0 and m==0:
        break
    A=[]
    for i in range(n):
        B=int(input())
        A.append(B)
    C=sum(A[0:m])
    D=C
    for i in range(m,n):
        C=C+A[i]-A[i-m]
        if C>D:
            D=C
    print(D)

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

Python: while True:
    n, k = map(int, input().split())
    if n == 0:
        break
    a = [int(input()) for _ in range(n)]
    s = sum(a[:k])
    result = s
    for i in range(n - k):
        s += a[k + i] - a[i]
        result = max(result, s)
    print(result)

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