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