#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long powm(long long base, long long exp, long long mod = 1000000007) {
  base %= mod;
  long long ans = 1;
  while (exp) {
    if (exp & 1LL) ans = (ans * base) % mod;
    exp >>= 1LL, base = (base * base) % mod;
  }
  return ans;
}
long long a[100005];
long long s[100005];
long long w, l;
bool check(long long k) {
  long long j = 1;
  for (int i = 0; i < w; i++) {
    if (a[i] == 0) continue;
    while (j < w && s[j] - s[i] < k) j++;
    if (j - i > l) return 0;
  }
  return 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> w >> l;
  for (long long i = 1; i < w; i++) {
    cin >> a[i];
    s[i] = s[i - 1] + a[i];
  }
  a[0] = 1;
  long long l = 0, r = 1e10;
  while (l < r) {
    long long m = (l + r + 1) / 2;
    if (check(m))
      l = m;
    else
      r = m - 1;
  }
  cout << l << '\n';
}
