def popcount32(x): x = x - ((x >> 1) & 0x55555555) x = (x & 0x33333333) + ((x >> 2) & 0x33333333) x = (x + (x >> 4)) & 0x0F0F0F0F x += x >> 8 x += x >> 16 return x & 0x0000003F n, k = map(int, input().split()) XY = [list(map(int, input().split())) for _ in range(n)] dist = [[1 << 60] * n for _ in range(1 << n)] for i in range(n): x, y = XY[i] d = (x**2 + y**2) ** 0.5 dist[1 << i][i] = d for bit in range(1, 1 << n): for i in range(n): if not (bit >> i & 1): continue for j in range(n): if bit >> j & 1: continue d = ((XY[i][0] - XY[j][0]) ** 2 + (XY[i][1] - XY[j][1]) ** 2) ** 0.5 dist[bit | 1 << j][j] = min(dist[bit | 1 << j][j], dist[bit][i] + d) D = [0] * (1 << n) for bit in range(1, 1 << n): mi = 1 << 60 if popcount32(bit) > k: D[bit] = mi continue for i in range(n): if bit >> i & 1: d = dist[bit][i] + (XY[i][0] ** 2 + XY[i][1] ** 2) ** 0.5 mi = min(mi, d) D[bit] = mi dp = [1 << 60] * (1 << n) dp[0] = 0 for bit in range(1, 1 << n): sub = bit while sub: dp[bit] = min(dp[bit], dp[bit ^ sub] + D[sub]) sub = (sub - 1) & bit print(dp[-1])