#include <bits/stdc++.h>
using namespace std;
long long a[1000001];
int main() {
  long long n, k, tong = 0, tongc;
  cin >> n >> k;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  if (k > 1) {
    for (long long i = 1; i <= k; i++) {
      tong += a[i];
    }
    tongc = tong;
    for (long long i = k; i <= n - 1; i++) {
      tong = tong - a[i - k + 1] + a[i + 1];
      tongc += tong;
    }
    cout << setprecision(17) << (double)tongc / (n - k + 1);
  } else {
    for (long long i = 1; i <= n; i++) {
      tong += a[i];
    }
    cout << setprecision(17) << (double)tong / n;
  }
}
