#include <bits/stdc++.h>
using namespace std;
int v[100100], frogs[100100];
int main() {
  int w, l;
  cin >> w >> l;
  for (int i = 1; i < w; i++) {
    cin >> v[i];
  }
  int down = 0, up = 1;
  frogs[0] = 1e9 + 1;
  v[w] = 1e9 + 1;
  while (down < w) {
    if (down == up)
      up++;
    else if (up > down + l)
      down++;
    else if (v[up] == 0)
      up++;
    else if (frogs[down] == 0)
      down++;
    else {
      int aux = min(v[up], frogs[down]);
      frogs[up] += aux;
      v[up] -= aux;
      frogs[down] -= aux;
    }
  }
  cout << frogs[w] << endl;
  return 0;
}
