#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie();
  int n;
  cin >> n;
  n--;
  vector<int> arr(n);
  int l;
  cin >> l;
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  int beg = -1;
  int end = 0;
  int ans = 0;
  int now = 0;
  for (end = 0; end < l; ++end) {
    now += arr[end];
  }
  end--;
  ans = now;
  while (end + 1 != arr.size()) {
    beg++;
    end++;
    now -= arr[beg];
    now += arr[end];
    ans = min(ans, now);
  }
  cout << ans;
  return 0;
}
