#include <bits/stdc++.h>
using namespace std;
double S;
int n, k;
vector<long long> A;
int main() {
  scanf("%d%d", &n, &k);
  int a;
  for (int i = 0; i < n; i++) {
    scanf("%lld", &a);
    A.push_back(a);
  };
  int K = k;
  k = min(k, n - k + 1);
  int l = 0;
  int r = n - 1;
  if (!(l >= r))
    for (int i = 1; i <= k; i++) {
      S += A[l] * i + A[r] * i;
      l++;
      r--;
      if (l >= r) break;
    };
  if (l == r) S += (A[l] * k);
  if (l < r)
    for (int i = l; i <= r; i++) {
      S += A[i] * k;
    };
  double kq = S / (n - K + 1);
  printf("%0.8f", kq);
  return 0;
}
