#include <bits/stdc++.h>
using namespace std;
const long long siz = 2 * 1e5 + 7;
long long bit[siz];
void update(long long idx, long long val) {
  while (idx < siz) {
    bit[idx] += val;
    idx += (idx & -idx);
  }
}
long long query(int idx) {
  long long sum = 0;
  while (idx) {
    sum += bit[idx];
    idx -= (idx & -idx);
  }
  return sum;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, k;
  cin >> n >> k;
  vector<long long> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    update(i + 1, v[i]);
  }
  long double have = 0;
  for (int i = 1; i <= n - k + 1; i++) {
    have += query(i + k - 1) - query(i - 1);
  }
  long double z = (n - k + 1);
  long double ans = have / z;
  cout << fixed << " " << setprecision(10) << ans << endl;
}
