#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int l = 0, r = k - 1, i = l;
  long long int sum = 0, newsum = 0;
  while (i <= r) {
    sum = sum + arr[i];
    i++;
  }
  newsum = sum;
  l++;
  r++;
  while (r != n) {
    newsum = newsum - arr[l - 1] + arr[r];
    sum = sum + newsum;
    l++;
    r++;
  }
  long long int x = n - k + 1;
  float y = sum / (float)x;
  printf("%0.10f", y);
}
