#include #include #include #include #define rep(i, n) for(i = 0; i < n; i++) #define int long long using namespace std; void chmin(double &a, double b) { a = min(a, b); } int INF = 1e+18; int n, K; int x[15], y[15]; double dp[1 << 15][15][15]; double dist(int a, int b) { double dx = x[a] - x[b]; double dy = y[a] - y[b]; return sqrt(dx * dx + dy * dy); } signed main() { int i, j, k, l; cin >> n >> K; rep(i, n) cin >> x[i + 1] >> y[i + 1]; n += 1; rep(i, (1 << n)) rep(j, n) rep(k, K + 1) dp[i][j][k] = INF; dp[1][0][K] = 0; rep(i, (1 << n)) { rep(j, n) { rep(k, K + 1) { if (dp[i][j][k] >= INF) continue; rep(l, n) { if ((i >> l) % 2) continue; if (k > 0) { chmin(dp[i + (1 << l)][l][k - 1], dp[i][j][k] + dist(j, l)); } chmin(dp[i + (1 << l)][l][K - 1], dp[i][j][k] + dist(j, 0) + dist(0, l)); } } } } double ans = INF; rep(i, n) { rep(j, K + 1) { chmin(ans, dp[(1 << n) - 1][i][j] + dist(i, 0)); } } printf("%.14f\n", ans); return 0; }