#include <bits/stdc++.h>
using namespace std;
int ara[200000], frog[200000];
set<int> s;
set<int>::iterator it;
int main() {
  int i, j, k, m, n, w, l;
  scanf("%d%d", &w, &l);
  for (int i = 1; i < w; i++) {
    scanf("%d", &ara[i]);
  }
  ara[w] = INT_MAX;
  for (int i = 1; i <= l; i++) {
    frog[i] = ara[i];
    ara[i] = 0;
  }
  s.insert(0);
  s.insert(w);
  for (int j = l + 1; j < w; j++) {
    s.insert(j);
  }
  for (int i = 1; i < w; i++) {
    int v = frog[i];
    s.erase(i);
    while (s.size() && v) {
      it = s.upper_bound(i);
      if (*it == 0) break;
      int f = *it;
      if ((f - i) > l) break;
      k = min(ara[f], v);
      v -= k;
      ara[f] -= k;
      frog[f] += k;
      if (ara[f] == 0) s.erase(f);
      if (f == w) break;
    }
  }
  cout << frog[w] << endl;
}
