#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n, k, i, j, a[N];
double sum, total;
int main() {
  scanf("%d%d", &n, &k);
  for (i = 0; i < n; ++i) scanf("%d", a + i);
  for (i = 0; i + k - 1 < n; ++i) {
    while (j < i + k) sum += a[j++];
    total += sum;
    sum -= a[i];
  }
  printf("%.9lf\n", total / (double)(n - k + 1));
  return 0;
}
