#include <iostream>
const int N = 1e6+10;
using namespace std;
int n, m;
long long w[N], s[N];
int main() {
cin >> n >> m;
for(int i = 1; i <= n; i++) cin >> w[i];
for(int i = 1; i <= n; i++) s[i] = s[i-1] + w[i];
long long res = 0;
for(int i = m; i <= n; i++)
res = max(res, s[i] - s[i - m - 1]);
cout << res << endl;
return 0;
}