#include <bits/stdc++.h>
using namespace std;
vector<int> caps, full;
int main() {
  int w, l;
  cin >> w >> l;
  caps = vector<int>(w + 1, 0);
  caps[w] = 2e9;
  full = vector<int>(w + 1, 0);
  full[0] = 2e9;
  for (int i = 1; i < w; i++) cin >> caps[i];
  int from = 0;
  int to = 1;
  while (from != w) {
    ;
    if (to == from)
      to++;
    else if (to - from > l) {
      ;
      from++;
    } else if (full[to] == caps[to]) {
      ;
      to++;
    } else if (full[from] == 0) {
      ;
      from++;
    } else {
      int k = min(full[from], caps[to] - full[to]);
      full[from] -= k;
      full[to] += k;
      ;
    }
  }
  cout << full[w] << endl;
}
