#include <bits/stdc++.h>
using namespace std;
long long n, k, a[1000001], sum, S;
double ans;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (i <= k) S += a[i];
  }
  sum = S;
  for (int i = 2; i <= n - k + 1; i++) {
    S = (S - a[i - 1] + a[i + k - 1]);
    sum += S;
  }
  ans = (double)sum / (n - k + 1);
  printf("%0.8lf\n", ans);
  return 0;
}
