#include <bits/stdc++.h>
using namespace std;
void fun() {}
unsigned long long int md = 998244353;
unsigned long long int __gcd(unsigned long long int a,
                             unsigned long long int b) {
  if (b == 0) return a;
  return __gcd(b, a % b);
}
unsigned long long int poww(unsigned long long int a, unsigned long long int b,
                            unsigned long long int md) {
  if (b < 0) return 0;
  if (a == 0) return 0;
  unsigned long long int res = 1;
  while (b) {
    if (b & 1) {
      res = (1ll * res * a) % md;
    }
    a = (1ll * a * a) % md;
    b >>= 1;
  }
  return res;
}
unsigned long long int poww(unsigned long long int a,
                            unsigned long long int b) {
  if (b < 0) return 0;
  if (a == 0) return 0;
  unsigned long long int res = 1;
  while (b) {
    if (b & 1) {
      res = (1ll * res * a);
    }
    a = (1ll * a * a);
    b >>= 1;
  }
  return res;
}
void ainp(unsigned long long int arr[], unsigned long long int n) {
  for (unsigned long long int i = 1; i <= n; i++) cin >> arr[i];
}
void disp(unsigned long long int arr[], unsigned long long int n) {
  for (unsigned long long int i = 1; i <= n; i++) cout << arr[i] << " ";
  cout << "\n";
}
void dispv(vector<unsigned long long int> &v) {
  for (unsigned long long int i = 0; i < v.size(); i++) cout << v[i] << " ";
  cout << "\n";
}
unsigned long long int divide(unsigned long long int a,
                              unsigned long long int b,
                              unsigned long long int md) {
  unsigned long long int rr = a * (poww(b, md - 2, md));
  rr %= md;
  return rr;
}
const unsigned long long int size = 1e5 + 1;
unsigned long long int w, l;
unsigned long long int arr[size];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  fun();
  cin >> w >> l;
  for (unsigned long long int i = 1; i <= w - 1; i++) {
    cin >> arr[i];
    arr[i] += arr[i - 1];
  }
  unsigned long long int minans = INT_MAX;
  for (unsigned long long int i = l; i <= w - 1; i++)
    minans = min(minans, arr[i] - arr[i - l]);
  cout << minans << "\n";
  return 0;
}
