#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  long long int a[n];
  for (long long int i = 0; i < (n); i++) cin >> a[i];
  long long int sum = 0;
  long long int temp = 0;
  for (int i = 0; i < n - k + 1; i += 1) {
    if (i == 0) {
      for (int j = 0; j < k; j += 1) {
        temp += a[j];
      }
    } else {
      temp = temp - a[i - 1] + a[i + k - 1];
    }
    sum += (double)temp;
  }
  printf("%.10f\n", (double)sum / (double)(n - k + 1));
}
