#include <bits/stdc++.h>
long long a[100005];
int main() {
  long long i, j, n, k, max = -1000000000000000;
  a[0] = 0;
  scanf("%lld%lld", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    if (i != 1) a[i] += a[i - 1];
  }
  for (i = k; i <= n; i++) {
    if ((a[i] - a[i - k]) > max) max = a[i] - a[i - k];
  }
  printf("%lld\n", max);
}
