Go: package main

import "fmt"

func main() {

	for true {
		var n, k int
		fmt.Scan(&n, &k)

		if n == 0 && k == 0 {
			return
		}
		
		a := make([]int, n)
		ans := make([]int, n)
		for i := 0; i < n; i++ {
			fmt.Scan(&a[i])
			if i == 0 {
				ans[i] = a[i]
			} else {
				ans[i] = ans[i-1] + a[i]
			}
		}
		max := 0
		for i := k; i < n; i++ {
			t := ans[i] - ans[i-k]
			if max < t {
				max = t
			}
		}
		fmt.Println(max)
	}
}

Python: while True:
  n,k = list(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])
  ss=[s]
  for i in range(k,n):
    s = s +a[i]- a[i-k]
    ss.append(s)
  print(max(ss))

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: 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: n,k=map(int,input().split())
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: 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: import queue
while 1:
    n,k=map(int,input().split())
    if n == 0:break
    r=queue.deque(int(input()) for _ in range(k))
    s=t=sum(r)
    for i in range(n-k):
        u=r.popleft()
        v=int(input())
        r.append(v)
        t+=v-u
        s=max(t,s)
    print(s)

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