#include <bits/stdc++.h>
using namespace std;
inline void setPrecision(int n) { cout.precision(n); }
long long int INF = 1e10;
int MOD = 1e9 + 7;
int n, l;
vector<int> a;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> l;
  --n;
  for (int i = 0, temp; i < n; ++i) {
    cin >> temp;
    a.push_back(temp);
  }
  int mv = 1e9;
  int dp[n];
  int i, j;
  int sumYet = 0;
  for (i = n - 1, j = 0; j < l; --i, ++j) {
    dp[i] = a[i];
    sumYet += a[i];
  }
  mv = sumYet;
  for (; i >= 0; --i) {
    dp[i] = min(a[i], sumYet);
    sumYet += dp[i];
    sumYet -= dp[i + l];
    mv = min(mv, sumYet);
  }
  cerr << ("dp") << ": ";
  for (int i = 0; i < n; ++i) cerr << dp[i] << " ";
  cerr << "\n";
  ;
  cout << mv;
  return 0;
}
