#include <bits/stdc++.h>
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
const int MAXN = 1e5 + 10, inf = 1e9 + 10, MAX = 1e4 + 10;
using namespace std;
int w, l;
int a[MAXN];
int main() {
  scanf("%d%d", &w, &l);
  for (int i = 1; i < w; i++) {
    scanf("%d", &a[i]);
    a[i] += a[i - 1];
  }
  int maxSum = 1000000009;
  for (int i = l; i < w; i++) maxSum = min(maxSum, a[i] - a[i - l]);
  printf("%d\n", maxSum);
}
