#include <bits/stdc++.h>
using namespace std;
int w = 100000, l;
vector<int> V(w + 1);
vector<int> pref(w);
int cnt = 0;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> w >> l;
  pref[0] = 0;
  for (int i = 0; i < w - 1; ++i) {
    cin >> V[i];
    cnt += V[i];
    pref[i + 1] = pref[i] + V[i];
  }
  int ans = cnt;
  for (int i = 0; i < w - 1 - l; ++i) {
    ans = min(ans, pref[i + l] - pref[i]);
  }
  cout << ans;
  return 0;
}
