#include <bits/stdc++.h>
using namespace std;
template <class T>
struct rge {
  T b, e;
};
template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
};
template <class A, class B>
ostream &operator<<(ostream &os, pair<A, B> p) {
  return os << "(" << p.first << ", " << p.second << ")";
}
template <class T>
ostream &operator<<(ostream &os, rge<T> d) {
  os << "[";
  for (auto it = d.b; it != d.e; it++) os << (it == d.b ? "" : ", ") << *it;
  return os << "]";
}
const int N = 1e5 + 5;
const long long inf = 1e18;
long long stones[N], frogs[N];
int n, jump;
bool can(long long x) {
  for (int i = (1); i <= ((n)); i += (+1)) {
    frogs[i] = 0;
  }
  frogs[0] = x;
  int l = 0, r = 1;
  while (l < n) {
    while (frogs[l] > 0) {
      while (r <= n && stones[r] - frogs[r] <= 0) {
        r++;
      }
      if (l + jump < r) {
        return false;
      }
      long long add = min(frogs[l], stones[r] - frogs[r]);
      frogs[r] += add;
      frogs[l] -= add;
    }
    l++;
    r = max(l + 1, r);
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0), cout.precision(15);
  cin >> n >> jump;
  for (int i = (1); i <= ((n - 1)); i += (+1)) {
    cin >> stones[i];
  }
  stones[n] = inf;
  long long lo = 0, hi = inf;
  while (lo + 1 < hi) {
    long long mid = (lo + hi) / 2;
    if (can(mid)) {
      lo = mid;
    } else {
      hi = mid;
    }
  }
  while (can(lo + 1)) {
    lo++;
  }
  cout << lo << '\n';
  return 0;
}
