#include <bits/stdc++.h>
using namespace std;
const int N = 200100;
int a[N];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  double ans = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    ans += a[i];
  }
  ans = ans * k / (n - k + 1);
  double res = 0;
  for (int i = 1; i <= k - 1; i++) {
    res += (double)a[i] * (k - i) / (n - k + 1);
    res += (double)a[n + 1 - i] * (k - i) / (n - k + 1);
  }
  printf("%lf\n", ans - res);
  return 0;
}
