#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, l;
  cin >> n >> l;
  vector<int> a(n);
  for (int i = 1; i < n; ++i) {
    cin >> a[i];
    a[i] += a[i - 1];
  }
  int ans = a[l];
  for (int i = l; i < n; ++i) {
    ans = min(ans, a[i] - a[i - l]);
  }
  cout << ans << "\n";
}
