#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, k;
  cin >> n >> k;
  double a[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  double cnt[n], l = min(n - k + 1, k);
  for (int i = 0; i < n; ++i) {
    cnt[i] = 0;
  }
  for (int i = 1; i <= l; ++i) {
    cnt[i - 1] = i;
    cnt[n - i] = i;
  }
  for (int i = 0; i < n; ++i) {
    if (cnt[i] == 0) {
      cnt[i] = l;
    }
  }
  double ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += a[i] * cnt[i];
  }
  cout << setprecision(10) << fixed << (ans / (n - k + 1));
}
