#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int cnt[maxn];
int main() {
  int width, jlen;
  cin >> width >> jlen;
  for (int i = 1; i <= width - 1; i++) {
    scanf("%d", &cnt[i]);
    cnt[i] += cnt[i - 1];
  }
  int ans = 0x3f3f3f3f;
  for (int i = 0; i + jlen <= width - 1; i++)
    ans = min(ans, cnt[i + jlen] - cnt[i]);
  cout << ans;
  return 0;
}
