#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
const double PI = acos(-1);
long long gcd() { return 0ll; }
template <typename T, typename... Args>
T gcd(T a, Args... args) {
  return __gcd(a, (__typeof(a))gcd(args...));
}
const int N = 1e5 + 2;
void Solve() {
  int n, l;
  cin >> n >> l;
  vector<long long> a(n - 1);
  for (auto &it : a) cin >> it;
  for (int i = 1; i < n - 1; i++) a[i] += a[i - 1];
  long long ma = a[l - 1];
  for (int i = l; i < n - 1; i++) {
    ma = min(ma, a[i] - a[i - l]);
  }
  cout << ma << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  { Solve(); }
  return 0;
}
