#include <bits/stdc++.h>
using namespace std;
template <typename T>
void sci(T& t) {
  cin >> t;
}
template <typename T, typename... Ts>
void sci(T& t, Ts&... ts) {
  sci(t);
  sci(ts...);
}
int32_t main() {
  cin.tie(nullptr);
  cout.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int64_t n, k;
  cin >> n >> k;
  vector<int64_t> a(n);
  for (int64_t(i) = 0; (i) < (int64_t)(n); ++(i)) {
    cin >> a[i];
  }
  int64_t sum = 0;
  long double ans = 0;
  int64_t i = 0;
  for (; i < k; ++i) {
    sum += a[i];
  }
  ans = sum;
  int64_t j = 0;
  while (i < n) {
    sum -= a[j];
    sum += a[i];
    j++, i++;
    ans += sum;
  }
  cout << fixed << setprecision(9) << ans / (n - k + 1);
  return 0;
}
