#include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5 + 7;
int w, l, a[maxN], ans, sum;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> w >> l;
  for (int i = 1; i < w; i++) cin >> a[i];
  for (int i = 1; i <= l; i++) sum = sum + a[i];
  ans = sum;
  for (int i = l + 1; i < w; i++) {
    sum = sum + a[i];
    sum = sum - a[i - l];
    ans = min(ans, sum);
  }
  cout << ans;
  return 0;
}
