#include <bits/stdc++.h>
using namespace std;
const long long limit = 1e5 + 1;
const long long inf = 1e7;
const long long mod = 1e9 + 7;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout.setf(ios::fixed);
  cout.precision(10);
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  double sum = 0;
  double total = 0;
  for (long long i = 0; i < m; i++) {
    sum += a[i];
  }
  for (long long i = 0; i < n - m + 1; i++) {
    total += sum;
    sum = sum - a[i] + a[i + m];
  }
  cout << total / (n - m + 1) << "\n";
  return 0;
}
