#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  while (~scanf("%d%d", &n, &k)) {
    long long lins, sum[n + 5];
    sum[0] = 0;
    for (int i = 0; i < n; i++) {
      scanf("%I64d", &lins);
      sum[i + 1] = sum[i] + lins;
    }
    double z = n - k + 1;
    double ans = 0;
    for (int i = k; i <= n; i++) {
      ans += double(sum[i] - sum[i - k]) / z;
    }
    printf("%.10f\n", ans);
  }
  return 0;
}
