#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("O3", "omit-frame-pointer", "inline")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,fma,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
const long long mod = 1000000007;
mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count());
const int mxN = 200010;
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  srand(time(NULL));
  cout << fixed << setprecision(9);
  int t = 1;
  while (t--) {
    int l, w;
    cin >> w >> l;
    vector<int> a(w + 1), b(w + 1);
    for (int i = 1; i < w; i++) cin >> a[i];
    a[w] = INT_MAX;
    for (int it = 0; it * l < w; it++) {
      int s = it * l + 1;
      int e = min(w - 1, (it + 1) * l);
      if (it == 0) {
        for (int i = s; i <= e; i++) b[i] = a[i];
      }
      for (int i = s, at = s + 1; i <= e; i++) {
        int cur = b[i];
        at = max(at, i + 1);
        while (cur > 0 && at <= min(w, i + l)) {
          int d = min(cur, a[at] - b[at]);
          b[at] += d;
          cur -= d;
          if (b[at] == a[at]) at++;
        }
      }
    }
    for (int i = 1; i <= w; i++) cerr << b[i] << " \n"[i == w];
    cout << b[w] << '\n';
  }
  return 0;
}
