#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  long int array1[n + 5];
  array1[0] = 0;
  for (int i = 1; i <= n - 1; i++) {
    cin >> array1[i];
    array1[i] += array1[i - 1];
  }
  long int ret = 1e10;
  for (int i = k; i <= n - 1; i++) {
    ret = min(ret, array1[i] - array1[i - k]);
  }
  cout << ret << endl;
}
