#include <bits/stdc++.h>
int main() {
  long long n, k, sum = 0, x, first;
  std::cin >> n >> k;
  long long a[n];
  for (int i = 0; i < n; ++i) std::cin >> a[i];
  long double d = 0;
  for (int i = 0; i < k; ++i) sum += a[i];
  d += sum;
  for (int i = 1; i < n - k + 1; ++i) {
    sum += a[i + k - 1] - a[i - 1];
    d += sum;
  }
  std::cout << std::setprecision(30) << d / (n - k + 1);
}
