#include <bits/stdc++.h>
using namespace std;
long long int prev1[200002], ans[200002];
int main() {
  long long int n, k, p;
  double r, r1;
  cin >> n >> k;
  int arr[n + 1];
  prev1[0] = 0;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
    prev1[i] = arr[i] + prev1[i - 1];
  }
  ans[k] = prev1[k];
  p = 0;
  for (int i = k + 1; i <= n; i++)
    ans[i] = (prev1[i - 1] - prev1[++p]) + arr[i] + ans[i - 1];
  r = (double)ans[n];
  r1 = (double)(n - k + 1);
  cout.precision(6);
  cout << fixed << r / r1 << endl;
}
