#include typedef struct { double x, y; } point; // The distance between p and q double distance(point p, point q) { return sqrt((p.x - q.x) * (p.x - q.x) + (p.y - q.y) * (p.y - q.y)); } const int bit[21] = {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 1048576}; void chmin(double *a, double b) { if (*a > b) *a = b; } int main() { int i, N, K; point p[15]; scanf("%d %d", &N, &K); for (i = 0, p[N].x = 0.0, p[N].y = 0.0; i < N; i++) scanf("%lf %lf", &(p[i].x), &(p[i].y)); int j, k, ii; double dp[16384][15][15], dist[15][15]; const double sup = 1e+16; for (k = 0; k < bit[N]; k++) for (i = 0; i <= N; i++) for (j = 0; j <= K; j++) dp[k][i][j] = sup; for (i = 0; i <= N; i++) for (j = 0; j <= N; j++) dist[i][j] = distance(p[i], p[j]); for (k = 0, dp[0][N][K] = 0.0; k < bit[N]; k++) { for (i = 0; i <= N; i++) { chmin(&(dp[k][N][K]), dp[k][i][0] + dist[i][N]); for (j = 1; j <= K; j++) { if (dp[k][i][j] == sup) continue; for (ii = 0; ii < N; ii++) chmin(&(dp[k | bit[ii]][ii][j-1]), dp[k][i][j] + dist[i][ii]); chmin(&(dp[k][N][K]), dp[k][i][j] + dist[i][N]); } } } printf("%.7lf\n", dp[bit[N]-1][N][K]); fflush(stdout); return 0; }