#include <bits/stdc++.h>
using namespace std;
ifstream fin("AAtest.in.txt");
long long l, w, k, mit, a[200005], su, mis, r, p;
vector<pair<long long, long long> > v[100005];
int main() {
  ios::sync_with_stdio(0);
  cin >> w >> l;
  for (int i = 1; i < w; i++) cin >> a[i];
  a[w] = 10000000000;
  k = l;
  while (k) {
    if (a[k]) v[0].push_back({k, a[k]}), mis += a[k];
    a[k] = 0;
    k--;
  }
  p = 0;
  while (v[p].size()) {
    long long vp = v[p][0].first;
    k = vp + l;
    for (auto i : v[p]) {
      k = min(k, i.first + l);
      while (k > i.first) {
        if (a[k]) {
          if (i.second <= a[k]) {
            if (k != w)
              if (!v[p + 1].size() || v[p + 1].back().first != k)
                v[p + 1].push_back({k, i.second});
              else
                v[p + 1].back().second += i.second;
            a[k] -= i.second;
            i.second = 0;
            break;
          } else if (k != w)
            if (!v[p + 1].size() || v[p + 1].back().first != k)
              v[p + 1].push_back({k, a[k]});
            else
              v[p + 1].back().second += a[k];
          i.second -= a[k];
          a[k] = 0;
        }
        k--;
      }
    }
    p++;
  }
  cout << 10000000000 - a[w] << "\n";
}
