#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const double pi = acos(-1.0);
const long long mod = 1e9 + 7;
const long long s = 1e7;
const int MAXN = 5e5 + 10;
int main() {
  int n, k;
  cin >> n >> k;
  vector<int> nums(n, 0);
  for (int i = 0; i < n; ++i) cin >> nums[i];
  int weeks = n - k + 1;
  long long sum = 0, init = 0;
  for (int j = 0; j < n - k + 1; ++j) init += nums[j];
  sum += init;
  for (int left = 0, right = n - k + 1; right < n && left < n;
       ++left, ++right) {
    init += (nums[right] - nums[left]);
    sum += init;
  }
  cout.precision(10);
  cout << (double)sum / weeks << endl;
  return 0;
}
