#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 7;
const long long INF = 1e16 + 7;
long long a[MAXN], pref[MAXN];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, l;
  cin >> n >> l;
  --n;
  for (long long i = 0; i < n; ++i) cin >> a[i];
  for (long long i = 0; i < n; ++i) pref[i + 1] = pref[i] + a[i];
  long long ans = INF;
  for (long long i = 0; i + l - 1 < n; ++i) {
    ans = min(ans, pref[i + l] - pref[i]);
  }
  cout << ans << '\n';
  return 0;
}
