#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n, k;
  cin >> n >> k;
  int* tab = new int[n];
  for (int i = 0; i < (n); ++i) cin >> tab[i];
  int weeks_n = n - k + 1;
  long long* pom = new long long[n];
  pom[0] = tab[0];
  for (int i = 1; i < n; i++) {
    pom[i] = pom[i - 1] + tab[i];
  }
  double suma = (double)pom[k - 1] / weeks_n;
  for (int i = k; i < n; i++) {
    suma += (double)(pom[i] - pom[i - k]) / weeks_n;
  }
  cout << fixed << setprecision(10) << suma;
  return 0;
}
