#include <bits/stdc++.h>
using namespace std;
int main() {
  long long w, len;
  cin >> w >> len;
  long long arr[w], sum = 0, ans = 0;
  for (int i = 0; i < w - 1; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < len; i++) sum += arr[i];
  ans = sum;
  for (int i = len; i < w - 1; i++) {
    sum = sum - arr[i - len] + arr[i];
    ans = min(ans, sum);
  }
  cout << ans << "\n";
  return 0;
}
