#include <bits/stdc++.h>
using namespace std;
const long long llinf = 2e18 + 7;
const int inf = 2e9 + 7;
const long long mod = 1e9 + 7;
const long long N = 2e6 + 7;
const long double pi = 3.14159265358979;
void solve() {
  long long n, k;
  cin >> n >> k;
  vector<long long> arr(n);
  for (int i = 0; i < n; i++) cin >> arr[i];
  long long sum = 0;
  vector<long long> brr;
  for (int i = 0; i < n - k + 1; i++) {
    sum += arr[i];
    brr.push_back(sum);
  }
  long double ans = sum;
  for (int i = n - k + 1, j = 0; i < n; i++, j++) {
    sum += arr[i];
    ans += sum - brr[j];
    brr.push_back(sum);
  }
  setprecision(20);
  ans = (ans / ((n - k + 1) * 1.0));
  cout << setprecision(20) << ans;
}
int main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  return 0;
}
