package yukicoder; import java.util.*; public class Q463 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); double[] c = new double[n]; for (int i = 1; i < n - 1; ++i) { c[i] = sc.nextDouble(); } // 魔法を使わずにマスi(0<=i= 0; --i) { double e1 = 0; for (int j = m; j >= 1; --j) { if (i + j >= n - 1) { e[i] = 0; continue outer; } else { e1 += 1.0 / m * (e[i + j] + c[i + j]); } } double e2 = 1L << 60; for (int j = m; j >= 1; --j) { e2 = Math.min(e2, v[i + j] + c[i + j]); } e[i] = Math.min(e1, e2); } System.out.printf("%.20f",e[0]); } static void show(double[][] mx) { int n = mx.length; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { System.out.print(mx[i][j] + " "); } System.out.println(); } } static double[] mul(double[][] a, double[] v) { int n = a.length; double[] ret = new double[n]; for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { ret[i] += a[i][j] * v[j]; } } return ret; } static void tr(Object... objects) { System.out.println(Arrays.deepToString(objects)); } }