#include <bits/stdc++.h>
using namespace std;
int n, k;
long long s[1000010], ans;
int main() {
  cin >> n >> k;
  for (int i = 1, a; i <= n; i++) scanf("%d", &a), s[i] = s[i - 1] + a;
  for (int i = 1; i <= n - k + 1; i++) ans += s[i + k - 1] - s[i - 1];
  printf("%.8lf", 1.0 * ans / (n - k + 1));
}
