#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const long long INF = 1e18;
const long long mod = 1e9 + 7;
clock_t time_p = clock();
void ktj() {
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p) / CLOCKS_PER_SEC << "\n";
}
long long w, k;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long l, i, j;
  cin >> w >> k;
  w--;
  long long a[w];
  for (i = 0; i < w; i++) {
    cin >> a[i];
  }
  long long ans = 0;
  long long sum = 0;
  for (i = 0; i < k; i++) {
    sum += a[i];
  }
  ans = sum;
  for (i = k; i < w; i++) {
    sum -= a[i - k];
    sum += a[i];
    ans = min(ans, sum);
  }
  cout << ans << '\n';
  ktj();
}
