#include <bits/stdc++.h>
using namespace std;
const int maxn = 2 * 1e5 + 5;
double sum;
int i, j, l, o, n, k, a[maxn];
int main() {
  scanf("%d %d", &n, &k);
  for (int j = 1; j <= n; j++) scanf("%d", &a[j]);
  for (i = 1; i <= n; i++) {
    if (i <= k) {
      if (n - k + 1 >= i)
        sum += 1.0 * i * a[i];
      else {
        l = i + k - 1 - n;
        l = i - l;
        sum += 1.0 * l * a[i];
      }
    } else {
      if (n - k + 1 >= i)
        sum += 1.0 * k * a[i];
      else {
        sum += 1.0 * (n - i + 1) * a[i];
      }
    }
  }
  sum /= (n - k + 1);
  printf("%.10lf\n", sum);
  return 0;
}
