#include <bits/stdc++.h>
using namespace std;
long long p[200005];
int n, k, a[200005];
long long ans;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n - k + 1; i++) {
    p[i]++;
    p[i + k]--;
  }
  for (int i = 1; i <= n; i++) p[i] += p[i - 1];
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ans += p[i] * a[i];
  }
  printf("%.6lf", 1.0 * ans / (n - k + 1));
  return 0;
}
