#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 2;
int n, l;
long long a[N], f[N];
int main() {
  scanf("%d %d", &n, &l);
  for (int i = 1; i < n; ++i) scanf("%lld", &a[i]), a[i] += a[i - 1];
  long long ans = LLONG_MAX;
  for (int i = l; i < n; ++i) ans = min(ans, a[i] - a[i - l]);
  printf("%lld\n", ans);
  return 0;
}
