#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int w, L, a[N], b[N];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> w >> L;
  for (int i = 1; i < w; i++) {
    cin >> a[i];
    if (i <= L) b[i] = a[i];
  }
  a[w] = 2e9;
  int p = 1;
  for (int i = L + 1; i <= w; i++) {
    while (i - p > L) p++;
    while (p < i && b[i] + b[p] <= a[i]) {
      b[i] += b[p];
      p++;
    }
    if (p < i && b[i] != a[i]) {
      int ned = a[i] - b[i];
      b[p] -= ned;
      b[i] = a[i];
    }
  }
  cout << b[w] << '\n';
  return 0;
}
