#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  double x;
  cin >> n >> k;
  double sum = 0, a;
  for (int i = 0; i < n; ++i) {
    cin >> a;
    int minn = k > (i + 1) ? (i + 1) : k;
    minn = minn > (n - i) ? (n - i) : minn;
    minn = minn > n - k + 1 ? n - k + 1 : minn;
    sum += a * minn;
  }
  x = sum / (n - k + 1);
  printf("%.10f", x);
  return 0;
}
