#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N, K;
  cin >> N >> K;
  vector<long long> a(100009);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  long long sum = 0;
  for (int i = 0; i < K; i++) {
    sum += a[i];
  }
  long long ans = sum;
  for (int i = 1; K + i <= N; i++) {
    sum = sum + a[K + i - 1] - a[i - 1];
    ans = max(ans, sum);
  }
  cout << ans << endl;
}
