#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  cout.precision(20);
  cout << fixed;
  int n, k;
  long long sum = 0;
  long long cur_sum = 0;
  int a[200001];
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i >= k - 1) {
      cur_sum += a[i];
      if (i - k >= 0) cur_sum -= a[i - k];
      sum += cur_sum;
    } else {
      cur_sum += a[i];
    }
  }
  double ans = sum;
  ans /= (double)(n - k + 1);
  cout << ans << endl;
}
