#include <bits/stdc++.h>
using namespace std;
long long int x[100007];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long int k, n, m, d, a, ans, b, temp = 0, ans1;
  cin >> n >> k;
  int arr[n];
  ans1 = ans = 10000000000000000;
  for (int i = 1; i < n; i++) {
    cin >> arr[i];
    x[i] = arr[i] + x[i - 1];
  }
  for (int i = k; i < n; i++) {
    ans = min(ans, x[i] - x[i - k]);
  }
  cout << ans << endl;
  return 0;
}
