#include <bits/stdc++.h>
using namespace std;
int n, k, a[(int)2e5];
long long sum;
double d, res;
int main() {
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (i < k) sum += a[i];
  }
  d = n - k + 1;
  res += sum / d;
  for (int i = k; i < n; ++i) {
    sum -= a[i - k];
    sum += a[i];
    res += sum / d;
  }
  cout << fixed << setprecision(6) << res;
  return 0;
}
