#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:128777216")
using namespace std;
const long double eps = pow(10.0, -10.0);
mt19937 rndm;
void start() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
  cout.setf(ios::fixed);
  string FILENAME = "sample";
  rndm.seed(time(0));
}
int main() {
  start();
  long long w, l;
  cin >> w >> l;
  vector<long long> vals(w - 1);
  for (int i = 0; i < w - 1; ++i) cin >> vals[i];
  long long sum = 0, minus = 0;
  for (int i = 0; i < l; ++i) sum += vals[i];
  for (int i = l; i < w - 1; ++i) {
    if (minus) {
      long long v = min(vals[i - l], minus);
      vals[i - l] -= v;
      minus -= v;
    }
    if (vals[i - l] < vals[i]) {
      vals[i] = min(vals[i], sum);
      minus += min(vals[i], sum) - vals[i - l];
    } else
      sum -= vals[i - l] - vals[i];
  }
  cout << sum;
  return 0;
}
