#include <bits/stdc++.h>
using namespace std;
bool sortbysec(const pair<long long, long long> &a,
               const pair<long long, long long> &b) {
  return (a.second < b.second);
}
bool isPrime(long long n) {
  if (n <= 1) return false;
  if (n <= 3) return true;
  if (n % 2 == 0 || n % 3 == 0) return false;
  for (int i = 5; i * i <= n; i = i + 6)
    if (n % i == 0 || n % (i + 2) == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j, k, n, m, a[200001], count = 0, sum = 0, x, d, y, z, c,
                                      b[150002] = {0}, t, ans, w, l;
  ;
  string s, s1, s2, s3;
  cin >> w >> l;
  for (i = 0; i < w - 1; i++) {
    cin >> a[i];
    sum = sum + a[i];
    b[i] = sum;
  }
  ans = b[l - 1];
  for (i = l; i < w - 1; i++) {
    ans = min(ans, b[i] - b[i - l]);
  }
  cout << ans;
}
