#include #define rep(i,n) for(int i=0;i void chmin(T& a, T b){a = min(a, b);} const long double INF = 80000000000; int main(){ int N, K; cin >> N >> K; vector x(N + 1), y(N + 1); rep(i, N) cin >> x[i] >> y[i]; x[N] = 0; y[N] = 0; auto dist = [&](int i, int j){ long double res = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]); return sqrtl(res); }; vector>> dp(N + 1, vector>(K + 1, vector(1 << N, INF))); dp[N][K][0] = 0; rep(bit, 1 << N){ rep(from, N + 1){ for(int k = 1; k <= K; k++){ rep(to, N){ if((bit >> to) && 1) continue; chmin(dp[to][k - 1][bit ^ (1 << to)], dp[from][k][bit] + dist(from, to)); } } for(int k = 0; k <= K; k++) chmin(dp[N][K][bit], dp[from][k][bit] + dist(from, N)); } } cout << setprecision(15); cout << dp[N][K][(1 << N) - 1] << "\n"; return 0; }