#include <bits/stdc++.h>
using namespace std;
long long i, n, m, k, a[200004];
double c;
int main() {
  cin >> n >> k;
  for (i = 1; i <= n; i++) {
    cin >> m;
    c += m * min(min(i, n - i + 1), min(k, n - k + 1));
  }
  c /= (n - k + 1);
  printf("%16.15f", c);
}
