import sys import math INF = 8000000000000000.0 def main(): input = sys.stdin.read data = input().split() N = int(data[0]) K = int(data[1]) x = [0] * (N + 1) y = [0] * (N + 1) index = 2 for i in range(N): x[i] = int(data[index]) y[i] = int(data[index + 1]) index += 2 x[N] = 0 y[N] = 0 dist = [[0] * (N + 1) for _ in range(N + 1)] for i in range(N + 1): for j in range(N + 1): res = (x[i] - x[j]) ** 2 + (y[i] - y[j]) ** 2 dist[i][j] = math.sqrt(res) dp = [[[INF] * (K + 1) for _ in range(N + 1)] for _ in range(1 << N)] dp[0][N][K] = 0.0 for bit in range(1 << N): for from_idx in range(N + 1): if from_idx < N and not (bit >> from_idx) & 1: continue for k in range(1, K + 1): for to in range(N): if (bit >> to) & 1: continue dp[bit | (1 << to)][to][k - 1] = min(dp[bit | (1 << to)][to][k - 1], dp[bit][from_idx][k] + dist[from_idx][to]) for k in range(K + 1): dp[bit][N][K] = min(dp[bit][N][K], dp[bit][from_idx][k] + dist[from_idx][N]) print("{:.15f}".format(dp[(1 << N) - 1][N][K])) if __name__ == "__main__": main()