#include <bits/stdc++.h>
using namespace std;
int a[100005], n, l, ans = 0x3f3f3f3f;
int main() {
  cin >> n >> l;
  for (int i = 1; i < n; i++) {
    scanf("%d", &a[i]);
    a[i] += a[i - 1];
  }
  for (int i = l; i < n; i++) ans = min(ans, a[i] - a[i - l]);
  cout << ans << endl;
  return 0;
}
