#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = 0;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return f ? x : -x;
}
const long long N = 1e5 + 10;
long long W, L, a[N], sum[N], mid, ans = LLONG_MAX;
signed main() {
  W = read(), L = read();
  for (long long i = 1; i < W; i++) {
    a[i] = read();
    sum[i] = sum[i - 1] + a[i];
  }
  for (long long i = 1; i + L - 1 < W; i++)
    ans = min(ans, sum[i + L - 1] - sum[i - 1]);
  printf("%lld", ans);
  return 0;
}
