#include <bits/stdc++.h>
using namespace std;
const int MAX = 1100100;
long long N, M;
long double A[MAX], sum;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> M;
  for (long long I = 0; I < N; I++) {
    cin >> A[I];
    long long cnt = min(min(N - M + 1, min(N - I, I + 1)), M);
    sum += A[I] * cnt;
  }
  cout << setprecision(10) << fixed;
  cout << sum / (N - M + 1) << endl;
}
