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

Python: def fun(n, k):
    A = [int(input()) for _ in range(n)]
    k_sum = 0
    maximam = 0
    for num, a in enumerate(A):
        if 0 <= num <= k-1:
            k_sum += a
        else:
            maximam = max(maximam, k_sum + a - A[num-k])
            k_sum = k_sum + a - 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 True:
    n , k = map(int,input().split())
    if (n,k) == (0,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=[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
    else:
        a=[int(input()) for i in range(n)]
        b = sum(a[0:k])
        c = []
        for i in range(n-k):
            b += a[k+i] - a[i]
            c.append(b)
        print(max(c))

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

Python: import queue
while True:
    n,k=map(int,input().split())
    if n==0:break
    a=queue.deque(int(input()) for _ in range(k))
    m=b=sum(a)
    for i in range(n-k):
        c=a.popleft()
        d=int(input())
        a.append(d)
        b+=d-c
        m=max(b,m)        
    print(m)

C++: #include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define RS resize
#define CLR clear
#define PB push_back
#define ALL(x) (x).begin(), (x).end()
using namespace std;

int main(){
	int n, k;
	vector< int > a;
	vector< int > r;
	
	while(cin >> n >> k, n){
		a.CLR();
		r.CLR();
		
		a.RS(n);
		r.RS(n - k + 1);
		
		REP(i, n) cin >> a[i];
		
		REP(i, k) r[0] +=  a[i];
		
		FOR(i, k, n){
			r[i-k+1] = r[i-k] + a[i] - a[i-k];
		}
		cout << *max_element(ALL(r)) << endl;
	}
	
	return 0;
}

C++: #include <iostream>
using namespace std;

int data[100000]={0};

int main(){
    int n,k;
    int sum = -1;
    int tmp,tmp2;
    while(1){
        cin >> n >> k;
        if(n == 0 && k == 0) break;
        for(int i=0;i<n;i++) cin >> data[i];
        for(int i=0;i<=(n-k)/2;i++){
            tmp = 0;
            tmp2 = 0;
            for(int j=i,g=n-(i+1);j<i+k;j++,g--){
                tmp += data[j];
                tmp2 += data[g];
            }
            if(sum < tmp) sum = tmp;
            else if(sum < tmp2) sum = tmp2;
        }
        cout << sum << endl;
    }
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

int a[100000];
int main(){
	int n,k;
	while(cin>>n>>k,n||k){
		int sum=0,ans= -10000*100000;
		for(int i=0;i<k;i++){
			cin>>a[i];
			sum += a[i];
		}
		ans=max(ans,sum);
		for(int i=k;i<n;i++){
			sum -= a[i-k];
			cin>>a[i];
			sum += a[i];
			ans=max(ans,sum);
		}
		cout<<ans<<endl;
	}
	return 0;
}

C++: #include<iostream>
#include<algorithm>
using namespace std;

int main(){
  int n,k;
  while( cin >> n >> k,n+k){
    
    int a[n];
    for(int i = 0;i < n;i++){
      cin >> a[i];
    }
    int sum = 0;
    for(int i = 0;i < n-k+1;i++){
      cout << i << endl;
      int s = 0;
      for(int j = i;j < i+k;j++){
	s += a[j];
      }
      sum = max(s,sum);
    }
    cout << sum <<  endl;
    
  }
  
}

C++: /*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
const lint INF = INT_MAX;
const lint LINF = LLONG_MAX;
const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<lint> a;
    vector<lint> s;
    lint ans = 0;
    while(true){
        a.resize(n);
        s.resize(n+1);
        ans = 0;
        for (int i=0; i<n; ++i){
            cin >> a[i];
        }
        s[0] = 0;
        for (int i=1; i<=n; ++i){
            s[i] = s[i-1] + a[i-1];
        }
        for (int i=0; i<n-k; ++i){
            ans = max(ans, s[i+k] - s[i]);
        }
        cout << ans << endl;
        cin >> n >> k;
        if(n == 0 && k == 0){
            break;
        }
    }
    return 0;
}