#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, a, sum, res, i, j;
  cin >> m >> n;
  int arr[m - 1];
  for (i = 0; i < m - 1; i++) {
    cin >> a;
    arr[i] = a;
  }
  res = INT_MAX;
  for (i = 0; i < m - n; i++) {
    sum = 0;
    for (j = i; j < i + n; j++) {
      sum = sum + arr[j];
    }
    if (sum < res) {
      res = sum;
    }
  }
  cout << res;
  return 0;
}
