#include <bits/stdc++.h>
using namespace std;
int main() {
  cout.setf(ios::fixed);
  long long int n, k, kk, nn;
  cin >> n >> k;
  long long int a[200004];
  a[200000] = 88;
  kk = k;
  nn = n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  long long int s = 0;
  if (n > 2) {
    long long int d = 0;
    if (n / 2 < k) {
      k = n - k + 1;
    }
    for (long long int i = 1; i < k; i++) {
      s += (a[i] + a[n - i + 1]) * i;
    }
    n = n - k + 1;
    for (long long int i = k; i <= n; i++) {
      s += a[i] * k;
    }
    double ans = s;
    double sd = nn - kk + 1;
    ans = ans / sd;
    cout << setprecision(6) << ans << endl;
  } else if (n == 2 && k == 2) {
    long long int s = a[1] + a[2];
    double ans = s;
    cout << setprecision(6) << ans << endl;
  } else if (n == 2 && k == 1) {
    long long int s = a[1] + a[2];
    double ans = s;
    double r = n - k + 1;
    ans /= r;
    cout << setprecision(6) << ans << endl;
  } else {
    double ans = a[1];
    cout << setprecision(6) << ans << endl;
  }
  return 0;
}
