#include <bits/stdc++.h>
using ll = long long;
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, k, i, j;
  ll total = 0, num;
  cin >> n >> k;
  int weeks = min(n - k + 1, k);
  for (i = 1; i <= n; i++) {
    cin >> num;
    if (i < weeks) {
      total += num * i;
    } else if (i > n - weeks + 1) {
      total += num * (n - i + 1);
    } else {
      total += num * weeks;
    }
  }
  printf("%.7f\n", (double)total / (n - k + 1));
  return 0;
}
