#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, k;
  cin >> n >> k;
  double a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  double ans = 0;
  double hold[n - k + 1];
  memset(hold, 0, sizeof(hold));
  for (int i = 0; i < k; i++) {
    hold[0] += a[i];
  }
  ans = hold[0] / (n - k + 1);
  for (int i = 1; i < n - k + 1; i++) {
    hold[i] = hold[i - 1] - a[i - 1] + a[i + k - 1];
    ans += (hold[i] / (n - k + 1));
  }
  cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
