#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
long long inf = 4e18;
const long long N = 1e5 + 5;
long long arr[N], l, w;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tt = 1;
  while (tt--) {
    cin >> w >> l;
    for (long long i = 1; i < w; ++i) {
      cin >> arr[i];
    }
    long long minn = inf, sum = 0;
    for (long long i = 1; i <= l; ++i) sum += arr[i];
    minn = min(minn, sum);
    for (long long i = l + 1; i < w; ++i) {
      sum -= arr[i - l];
      sum += arr[i];
      minn = min(minn, sum);
    }
    cout << minn;
  }
  return 0;
}
