#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void amin(T &a, U b) {
  a = (a > b ? b : a);
}
template <typename T, typename U>
inline void amax(T &a, U b) {
  a = (a > b ? a : b);
}
void solve() {
  int W, L;
  cin >> W >> L;
  vector<int> a(W);
  vector<int> dp(W, 0);
  for (int i = 1; i < W; ++i) cin >> a[i];
  int l = 0;
  for (int i = 1; i <= L; ++i) {
    dp[i] = a[i];
  }
  for (int i = L + 1; i < W; ++i) {
    int x = a[i];
    int sum = 0;
    while (l < i - L) l++;
    while (sum < a[i] && l < i) {
      int req = min(x, dp[l]);
      dp[l] -= req;
      sum += req;
      x -= req;
      if (!dp[l]) ++l;
    }
    dp[i] += sum;
    do {
    } while (0);
  }
  int ans = 0;
  while (l < W) {
    do {
    } while (0);
    do {
    } while (0);
    ans += dp[l];
    ++l;
  }
  cout << ans << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int tests = 1;
  while (tests--) {
    solve();
  }
}
