#include <bits/stdc++.h>
using namespace std;
void input() {
  freopen("give_me.txt", "r", stdin);
  freopen("see_it.txt", "w", stdout);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long n, k;
  cin >> n >> k;
  long long a[n], sum = 0, w = n - k + 1;
  for (int i = 0; i < n; i++) cin >> a[i];
  long long gun[n], cur = 1, mx = k;
  if (k > n / 2) mx = (n - k) + 1;
  if (n % 2 == 0) {
    for (int i = 0; i < n / 2; i++) {
      gun[i] = cur;
      gun[n - i - 1] = cur;
      if (cur <= mx - 1) cur++;
    }
  } else {
    for (int i = 0; i <= n / 2; i++) {
      gun[i] = cur;
      gun[n - i - 1] = cur;
      if (cur <= k - 1) cur++;
    }
  }
  for (int i = 0; i < n; i++) {
    sum += (a[i] * gun[i]);
  }
  double ans = (1.0 * sum / w);
  printf("%.6lf", ans);
  return 0;
}
