#include <bits/stdc++.h>
int main() {
  int i, j, n, k;
  float average = 0;
  scanf("%d%d", &n, &k);
  float T[n];
  for (i = 0; i < n; i++) scanf("%f", &T[i]);
  if (k - 1 <= n - k) {
    for (i = k - 1; i <= n - k; i++) average += T[i] * k;
    for (i = 0; i < k - 1; i++)
      average += (T[i] * (i + 1) + T[n - i - 1] * (i + 1));
  } else {
    for (i = n - k; i < k; i++) average += T[i] * (n - k + 1);
    for (i = 0; i < n - k; i++)
      average += (T[i] * (i + 1) + T[n - i - 1] * (i + 1));
  }
  printf("%.6f", average / (n - k + 1));
}
