#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, z;
  int sol;
  int s[100009];
  cin >> x >> y;
  s[0] = 0;
  for (int i = 1; i < x; i++) {
    cin >> z;
    s[i] = z + s[i - 1];
  }
  sol = s[y];
  for (int i = y + 1; i < x; i++) {
    sol = min(sol, s[i] - s[i - y]);
  }
  cout << sol << endl;
}
