#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, a[N], jump;
int have[N];
int main() {
  scanf("%d %d", &n, &jump);
  for (int i = 1; i < n; ++i) scanf("%d", &a[i]);
  have[0] = 1e9;
  a[n] = 1e9;
  int ptr = 0;
  for (int i = 1; i <= n; ++i) {
    while (ptr < i && have[i] < a[i]) {
      if (ptr < i - jump)
        ++ptr;
      else {
        int take = min(a[i] - have[i], have[ptr]);
        have[i] += take;
        have[ptr] -= take;
        if (have[ptr] == 0) ++ptr;
      }
    }
  }
  printf("%d\n", have[n]);
  return 0;
}
