import math INF = 1.0e15 n, k = map(int, input().split()) points = [tuple(map(int, input().split())) for _ in range(n)] points.append((0, 0)) dist = [[INF for _ in range(n + 1)] for _ in range(n + 1)] for u in range(n + 1): xu, yu = points[u] dist[u][u] = 0 for v in range(u + 1, n + 1): xv, yv = points[v] dist[u][v] = dist[v][u] = math.sqrt((xv - xu) ** 2 + (yv - yu) ** 2) tours = [[INF for _ in range(n + 1)] for _ in range(1 << (n + 1))] tours[0][n] = 0.0 for mask in range(1 << (n + 1)): c = sum([(mask >> u) & 1 for u in range(n)]) if c > k: continue for cur in range(n + 1): for nxt in range(n + 1): if (mask >> nxt) & 1 != 0: continue visited = mask | (1 << nxt) if c < k or (c == k and nxt == n): tours[visited][nxt] = min(tours[visited][nxt], tours[mask][cur] + dist[cur][nxt]) dp = [INF for _ in range(1 << n)] dp[0] = 0.0 for mask in range(1, 1 << n): subset = mask while subset > 0: subset = (subset - 1) & mask dp[mask] = min(dp[mask], dp[subset] + tours[(1 << n) | (mask - subset)][n]) print(dp[-1])