#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9 + 9;
const int maxN = 1e5 + 5;
int main() {
  int n, k, a[maxN], i, res = inf;
  a[0] = 0;
  cin >> n >> k;
  for (i = 1; i < n; i++) {
    cin >> a[i];
    a[i] += a[i - 1];
    if (i >= k) res = min(res, a[i] - a[i - k]);
  }
  cout << res;
}
