#include <bits/stdc++.h>
using namespace std;
int a[100005], pos[100005];
int find_par(int v) {
  if (pos[v] == v) return v;
  return pos[v] = find_par(pos[v]);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int w, l;
  cin >> w >> l;
  for (int i = 1; i < w; i++) {
    cin >> a[i];
    if (a[i] == 0)
      pos[i] = pos[i - 1];
    else
      pos[i] = i;
  }
  int ans = 0;
  while (true) {
    int uk = 0, ms = 10005;
    bool fl = true;
    while (uk < w) {
      uk += l;
      if (uk >= w) break;
      int t = find_par(uk);
      if (t <= uk - l) {
        fl = false;
        break;
      }
      uk = t;
      ms = min(a[uk], ms);
    }
    if (!fl) break;
    ans += ms;
    uk = 0;
    while (uk < w) {
      uk += l;
      if (uk >= w) break;
      uk = find_par(uk);
      a[uk] -= ms;
      if (a[uk] == 0) pos[uk] = find_par(uk - 1);
    }
  }
  cout << ans;
  return 0;
}
