#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  long long a[n], sum = 0, o = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (((i + 1) - k < 0) && i + k <= n) {
      sum = sum + (a[i] * (i + 1));
      o++;
    } else if ((i + 1) + k > n && o != k && (n + 1) / k < 2) {
      sum = sum + (a[i] * o);
      if (i + o == n) o = k;
    } else if ((i + 1) + k > n) {
      sum = sum + (a[i] * (n - i));
    } else
      sum = sum + (a[i] * k);
  }
  n = n - k + 1;
  double l = (1.0 * sum) / (n);
  printf("%0.6lf\n", l);
  return 0;
}
