#include <bits/stdc++.h>
using namespace std;
int n, m, s[100010], ans = 1e9 + 7;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1, x; i < n; i++) {
    scanf("%d", &x);
    s[i] = s[i - 1] + x;
  }
  for (int i = 0; i + m < n; i++) ans = min(ans, s[i + m] - s[i]);
  printf("%d", ans);
  return 0;
}
