#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
long long n, l1;
long long pre[100004] = {0};
void init() {
  pre[0] = a[0];
  for (int i = 1; i < n - 1; ++i) {
    pre[i] = pre[i - 1] + a[i];
  }
}
bool possible(long long x) {
  long long ans = 0;
  for (int i = 0; i < n - 1; ++i) {
    if (i >= l1) {
      ans = min(ans, pre[i] - pre[i - l1]);
    } else {
      ans = pre[i];
    }
  }
  return (ans >= x);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> l1;
  a.resize(n - 1);
  long long sum = 0;
  for (long long& x : a) {
    cin >> x;
    sum += x;
  }
  init();
  long long l = 0, r = sum + 1;
  while (l < r) {
    long long mid = (l + r) >> 1;
    if (possible(mid))
      l = mid + 1;
    else
      r = mid;
  }
  cout << (l - 1) << endl;
}
