#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, k, sum = 0;
  cin >> n >> k;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (i < k) sum += a[i];
  }
  long long ans = sum;
  for (long long i = k; i < n; i++) {
    sum = sum + a[i];
    sum = sum - a[i - k];
    ans = ans + sum;
  }
  cout << setprecision(10) << fixed << double(ans) / (n - k + 1);
}
