#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int a[N];
int main() {
  int w, l;
  scanf("%d %d", &w, &l);
  for (int i = 1; i < w; i++) scanf("%d", a + i);
  queue<int> q;
  a[w] = 0x3f3f3f3f;
  int ans = 0;
  for (int i = 1; i <= l; i++) {
    q.push(a[i]);
    ans += a[i];
  }
  for (int i = l + 1; i <= w; i++) {
    int here = 0;
    while (!q.empty() and here + q.front() <= a[i]) {
      here += q.front();
      q.pop();
    }
    if (!q.empty()) {
      q.front() -= a[i] - here;
      here = a[i];
    }
    q.push(here);
    while (q.size() > l) {
      ans -= q.front();
      q.pop();
    }
  }
  printf("%d\n", ans);
  return 0;
}
