import java.util.Arrays; import java.util.Scanner; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); int[] x = new int[n + 1]; int[] y = new int[n + 1]; for (int i = 0; i < n; i++) { x[i] = sc.nextInt(); y[i] = sc.nextInt(); } sc.close(); double inf = 1e18; int n2 = 1 << n; double[][][] dp = new double[n2][n + 1][k + 1]; for (int i = 0; i < n2; i++) { for (int j = 0; j <= n; j++) { Arrays.fill(dp[i][j], inf); } } dp[0][n][k] = 0; double[][] d = new double[n + 1][n + 1]; for (int i = 0; i <= n; i++) { for (int j = i + 1; j <= n; j++) { d[i][j] = d[j][i] = Math.hypot(x[i] - x[j], y[i] - y[j]); } } for (int i = 0; i < n2; i++) { for (int j = 0; j < n; j++) { if ((i >> j & 1) == 1) { for (int j2 = 0; j2 < n; j2++) { if ((i >> j2 & 1) == 0) { int ni = i | (1 << j2); for (int a = 1; a < k; a++) { double alt = dp[i][j][a] + d[j][j2]; dp[ni][j2][a - 1] = Math.min(dp[ni][j2][a - 1], alt); } } } for (int a = 0; a < k; a++) { double alt = dp[i][j][a] + d[j][n]; dp[i][n][k] = Math.min(dp[i][n][k], alt); } } } for (int j2 = 0; j2 < n; j2++) { if ((i >> j2 & 1) == 0) { int ni = i | (1 << j2); double alt = dp[i][n][k] + d[n][j2]; dp[ni][j2][k - 1] = Math.min(dp[ni][j2][k - 1], alt); } } } System.out.println(dp[n2 - 1][n][k]); } }