#include <bits/stdc++.h>
using namespace std;
int A[500005];
int reach[500005];
void solve() {
  int w, l;
  cin >> w >> l;
  if (l == 1) {
    int ans = 2e9;
    for (long long i = 0; i < w - 1; i++) {
      int x;
      cin >> x;
      ans = min(x, ans);
    }
    cout << ans << endl;
    return;
  }
  for (long long i = 1; i < w; i++) {
    cin >> A[i];
    if (i <= l) reach[i] = A[i];
  }
  A[w] = 2e9;
  long long ans = 0;
  int ptr1 = 1;
  int ptr2 = l + 1;
  while (ptr2 <= w) {
    ptr1 = max(ptr1, ptr2 - l);
    if (reach[ptr1] + reach[ptr2] <= A[ptr2]) {
      reach[ptr2] += reach[ptr1];
      reach[ptr1] = 0;
      ptr1++;
    } else {
      reach[ptr1] -= (A[ptr2] - reach[ptr2]);
      reach[ptr2] = A[ptr2];
      ptr2++;
    }
    if (ptr1 == ptr2) {
      ptr2++;
    }
  }
  cout << reach[w] << endl;
}
int main() {
  std::ios::sync_with_stdio(false);
  ;
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
