#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
int v[N];
int n, k;
int main() {
  scanf("%d %d", &n, &k);
  n--;
  for (int i = 1; i <= n; ++i) scanf("%d", v + i), v[i] += v[i - 1];
  int ans = 0x3F3F3F3F;
  for (int i = k; i <= n; ++i) ans = min(ans, v[i] - v[i - k]);
  printf("%d\n", ans);
  return 0;
}
