#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int a[n];
  long long b[n - k + 1];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < n - k + 1; ++i) {
    b[i] = 0;
  }
  for (int i = 0; i < k; ++i) {
    b[0] = b[0] + a[i];
  }
  for (int i = 1; i < n - k + 1; ++i) {
    b[i] = b[i - 1] + a[i + k - 1] - a[i - 1];
  }
  double sum = 0;
  for (int i = 0; i < n - k + 1; ++i) {
    sum = sum + b[i];
  }
  cout << setprecision(20) << (sum / (n - k + 1)) << endl;
}
