#include <bits/stdc++.h>
using LL = long long;
using namespace std;
const int N = 100005;
int l, w, a[N];
int main() {
  scanf("%d%d", &w, &l);
  for (int i = 1; i < w; i++) scanf("%d", a + i);
  int minv = (int)1e9, ss = 0;
  for (int i = 1; i <= l; i++) ss += a[i];
  minv = min(ss, minv);
  for (int i = l + 1; i <= w - 1; i++) {
    ss -= a[i - l];
    ss += a[i];
    minv = min(ss, minv);
  }
  printf("%d\n", minv);
}
