#include <bits/stdc++.h>
using namespace std;
const long long maxn = 6e5;
const long long maxx = 1e9;
double long s;
long long n, k, a[maxn], q;
int main() {
  cin >> n >> k;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
  }
  for (int i = 2; i <= n; i++) {
    a[i] += a[i - 1];
  }
  for (int i = k; i <= n; i++) {
    s += (a[i] - a[i - k]);
  }
  cout << fixed << setprecision(10) << s / ((double)n - k + 1);
}
