#include <bits/stdc++.h>
using namespace std;
int n, k;
int a[212345];
long long b[212345];
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i + 1] = b[i] + a[i];
  }
  double res = 0;
  double div = n - k + 1;
  for (int i = 0; i + k <= n; i++) {
    res += 1.0 * (b[i + k] - b[i]) / div;
  }
  cout.precision(20);
  cout << res;
}
