import java.io.*; import java.util.*; public class Main_yukicoder463_1 { private static Scanner sc; private static Printer pr; private static void solve() { final long INF = -1; int n = sc.nextInt(); int m = sc.nextInt(); int[] a = new int[n]; for (int i = 0; i < n - 2; i++) { a[i + 1] = sc.nextInt(); } if (m == n - 1) { pr.println(0); return; } long[][] ex = new long[n - 1][n]; int[][] cnt = new int[n - 1][n]; for (int i = 0; i < n - 1; i++) { Arrays.fill(ex[i], INF); ex[i][n - 1] = 0; } for (int i = 1; i <= m; i++) { ex[0][i] = a[i]; cnt[0][i]++; } // double[] mm = new double[n - 1]; // mm[0] = (double)1 / m; // for (int i = 1; i < n - 1; i++) { // mm[i] = mm[i - 1] / m; // } for (int k = 1; k < n - 1; k++) { for (int i = k; i < n - 1; i++) { if (i + m >= n - 1) { ex[k][n - 1] += Math.max(0, ex[k - 1][i]); cnt[k][n - 1] += cnt[k - 1][i]; } else if (ex[k - 1][i] != INF) { for (int j = 1; j <= m; j++) { ex[k][i + j] = Math.max(0, ex[k][i + j]) + ex[k - 1][i] + a[i + j]; cnt[k][i + j] += cnt[k - 1][i]; } } } } double sum = 0; double mm = (double)1 / m; double sumcnt = 0; for (int i = 1; i < n - 1; i++) { sum += ex[i][n - 1] * mm; sumcnt += cnt[i][n - 1] * mm; mm /= m; } pr.printf("%.10f\n", sum); // pr.println(sumcnt); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } private static class Printer extends PrintWriter { Printer(PrintStream out) { super(out); } } }