#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>
#include <cassert>

using namespace std;

/* template */

using ll = long long;

void debug_out() { std::cout << std::endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, a, n) for (int i = (int)(a); i < (int)(n); i++)
#define rrep(i, a, n) for (int i = ((int)(n-1)); i >= (int)(a); i--)
#define Rep(i, a, n) for (long long i = (long long)(a); i< (long long)(n); i++)
#define RRep(i, a, n) for (long long i = ((long long)(n-1ll)); i>=(long long)(a); i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

template <class T>
inline bool chmin(T &a, T b){
    if (a > b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
inline bool chmax(T &a, T b){
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr ll LNF = 1e18+7;

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

/* template */

template<class SemiGroup> struct DisjointStarseTable{
    using F= std::function<SemiGroup(SemiGroup,SemiGroup)>;
    F fn;
    std::vector<std::vector<SemiGroup>> data;
    std::vector<int> height;

    DisjointStarseTable(const std::vector<SemiGroup> &init_vec,F fn) : fn(fn) {
        int n = (int)init_vec.size(), h = 1;
        while((1<<h)<n) h++;
        data.assign(h,std::vector<SemiGroup>(n));
        height.assign((1<<h),0);
        for(int i = 2; i< (1<<h); i++) height[i] = height[i>>1]+1;
        for(int i = 0; i< n; i++) data[0][i] = init_vec[i];
        for(int i = 1; i< h; i++){
            int s = (1<<i);
            for(int j = 0; j<n; j += (s<<1)){
                int t = min(j+s,n);
                data[i][t-1] = init_vec[t-1];
                for(int k = t-2; k >= j; k--){
                    data[i][k] = fn(init_vec[k],data[i][k+1]);
                }
                if(n <= t) break;
                data[i][t] = init_vec[t];
                for(int k = t+1; k< min(t+s,n); k++) data[i][k] = fn(data[i][k-1],init_vec[k]);
            }
        }
    }

    SemiGroup query(int l,int r){
        assert(l<r);
        if(l >= --r) return data[0][l];
        return fn(data[height[l^r]][l],data[height[l^r]][r]);
    }
};

int solve(){
    int n,k; cin >> n >> k;
    if(n==0 && k==0) return 0;
    vector<ll> a(n);
    rep(i,0,n) cin >> a[i];
    DisjointStarseTable<ll> c(a,[](ll a,ll b){ return a+b;});
    ll ans = -LNF;
    rep(i,0,n-k+1){
        chmax(ans,c.query(i,i+k));
    }
    cout << ans << endl;
    return 1;
    
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int flag = 1;
    while(flag){
        flag = solve();
    }
}


Measured memory_bytes: 17920