#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:36777216")
using namespace std;
const int magicconst = 1e7;
const long long mod = 1e9 + 7;
long long w, l;
vector<long long> stones;
bool can(long long x) {
  int left = 0;
  vector<long long> abcd(stones.size());
  abcd[0] = x;
  for (int right = 1; right < stones.size(); right++) {
    while (left < right && abcd[left] == 0) {
      left++;
    }
    if (right - left > l) return false;
    while (left < right && abcd[right] < stones[right]) {
      long long razn = min(stones[right] - abcd[right], abcd[left]);
      abcd[left] -= razn;
      abcd[right] += razn;
      if (abcd[left] == 0) left++;
    }
  }
  return abcd[abcd.size() - 1] == x;
}
void Solve() {
  cin >> w >> l;
  stones.reserve(w + 1);
  stones.push_back(1e9);
  for (int i = 0; i < w - 1; i++) {
    long long tmp;
    cin >> tmp;
    stones.push_back(tmp);
  }
  stones.push_back(1e9);
  long long left = 0;
  long long right = 1e9;
  while (left != right) {
    if (right < 10) {
      bool f = true;
    }
    long long mid = (left + right + 1) / 2;
    if (can(mid)) {
      left = mid;
    } else {
      right = mid - 1;
    }
  }
  cout << left << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  Solve();
}
