#include <bits/stdc++.h>
using namespace std;
long long int arr[10000000];
bool test(long long int x, int w, int l) {
  int index1 = 0;
  int index2 = 0;
  long long int arr2[2 * w];
  long long int arr1[w - 1];
  for (int i = 0; i < w; i++) arr2[i] = 0;
  for (int i = 0; i < w; i++) arr1[i] = arr[i];
  arr2[0] = x;
  while (index1 < w && index2 < w) {
    while (arr1[index1] > 0 && index2 < w && index1 < w) {
      long long int sapos = min(arr2[index2], arr1[index1]);
      arr2[index2] -= sapos;
      arr2[index1 + 1] += sapos;
      arr1[index1] -= sapos;
      if (index1 - index2 >= l) return false;
      while (arr2[index2] == 0) {
        index2++;
      }
    }
    index1++;
  }
  for (int i = 0; i < w; i++) {
    if (arr2[i] != 0) return false;
  }
  return true;
}
int main() {
  int w, l;
  cin >> w >> l;
  for (int i = 0; i < w - 1; i++) cin >> arr[i];
  arr[w - 1] = 1000000000000;
  long long int lo, hi;
  lo = 0;
  hi = 100000000000000;
  while (hi - lo > 1) {
    long long int mid = (lo + hi) / 2;
    bool b = test(mid, w, l);
    if (b)
      lo = mid;
    else
      hi = mid;
  }
  cout << lo << endl;
  return 0;
}
