#include #define rep(i,n) for(int i=0;i void chmin(T& a, T b){a = min(a, b);} const long double INF = 8000000000000000; template ostream& operator<<(ostream& os, const vector& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;} template ostream& operator<<(ostream& os, const vector>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;} 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; vector> dist(N + 1, vector(N + 1)); rep(i, N + 1) rep(j, N + 1){ long double res = (x[i] - x[j]) * (x[i] - x[j]) + (y[i] - y[j]) * (y[i] - y[j]); dist[i][j] = sqrtl(res); } vector> f(1 << N, vector(N + 1, INF)); f[0][N] = 0; rep(bit, 1 << N){ rep(from, N + 1){ if(from < N) if((~bit >> from) & 1) continue; rep(to, N){ if((bit >> to) & 1) continue; chmin(f[bit | (1 << to)][to], f[bit][from] + dist[from][to]); } } } vector g(1 << N, INF); rep(bit, 1 << N){ int cnt = __builtin_popcount(bit); if(cnt <= K){ rep(from, N){ chmin(g[bit], f[bit][from] + dist[from][N]); } } } rep(bit1, 1 << N){ for(int bit2 = bit1; bit2 > 0; bit2 = ((bit2 - 1) & bit1)){ chmin(g[bit1], g[bit1 - bit2] + g[bit2]); } } cout << setprecision(15); cout << g[(1 << N) - 1] << "\n"; return 0; }