#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long INFL = LLONG_MAX;
const long double pi = acos(-1);
int W, L;
int A[100100];
int cnt[100100];
int used[100100];
int f(int frogs) {
  stack<int> stones;
  memset(cnt, 0, sizeof(cnt));
  ;
  memset(used, 0, sizeof(used));
  ;
  cnt[0] = frogs;
  for (int i = 1; i <= W; i++) {
    if (A[i] >= 1) {
      stones.push(i);
    }
    if (i >= L) {
      int j = i - L;
      if (cnt[j] > 0) {
        while (!stones.empty()) {
          int index = stones.top();
          stones.pop();
          if (index <= j || used[index] == A[index]) {
            continue;
          }
          int remstones = A[index] - used[index];
          int jump = min(cnt[j], remstones);
          cnt[index] += jump;
          used[index] += jump;
          cnt[j] -= jump;
          if (used[index] < A[index]) {
            stones.push(index);
          }
          if (cnt[j] == 0) {
            break;
          }
        }
        if (cnt[j] > 0) {
          return 0;
        }
      }
    }
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cout.precision(15);
  cout << fixed;
  cout.tie(0);
  cin.tie(0);
  cin >> W >> L;
  for (int i = 1; i <= W - 1; i++) {
    cin >> A[i];
  }
  A[W] = 1e9;
  int good = 0;
  int bad = (int)1e9 + 1;
  while (good + 1 < bad) {
    int m = (good + bad) / 2;
    if (f(m)) {
      good = m;
    } else {
      bad = m;
    }
  }
  cout << good << '\n';
}
