#include using namespace std; long double dp[110]; int main() { int n, m; cin >> n >> m; if (n == 2) { printf("0\n"); return 0; } int c[110]; for (int i = 1; i < n - 1; ++i) { cin >> c[i]; } for (int i = n - m - 2; i >= 0; i--) { for (int j = 1; j <= m; j++) dp[i] += dp[i + j] + c[i + j]; dp[i] /= m; } printf("%.18Lf\n", dp[0]); return 0; }