#include<iostream> #include<string> #include<queue> #include<vector> #include<cassert> #include<random> #include<set> #include<map> #include<cassert> #include<unordered_map> #include<bitset> #include<numeric> #include<algorithm> using namespace std; using ll = long long; const int inf=1<<30; const ll INF=1LL<<62; typedef pair<ll,ll> P; typedef pair<int,P> PP; const ll MOD=998244353; const int dy[]={0,1,0,-1}; const int dx[]={1,0,-1,0}; void chmin(double &a,const double &b){ a=min(a,b); } int main(){ int N,K; cin>>N>>K; vector<P> pos(N+1); for(int i=0;i<N;i++){ cin>>pos[i].first>>pos[i].second; } auto dist=[&](const P lhs,const P rhs)->double{ double dx=lhs.first-rhs.first; double dy=lhs.second-rhs.second; return sqrt(dx*dx+dy*dy); }; vector dp(1<<N,vector<vector<double>>(N,vector<double>(K+1,INF))); for(int i=0;i<N;i++){ dp[1<<i][i][K-1]=dist({0,0},pos[i]); } for(int S=0;S<(1<<N);S++){ for(int k=0;k<=K;k++){ for(int now=0;now<N;now++){ if(!(S>>now&1)) continue; for(int to=0;to<N;to++){ if((S>>to)&1) continue; if(k-1>=0){ chmin(dp[S|1<<to][to][k-1],dp[S][now][k]+dist(pos[now],pos[to])); } chmin(dp[S|1<<to][to][K-1],dp[S][now][k]+dist(pos[now],{0,0})+dist({0,0},pos[to])); } } } } double ans=INF; for(int t=0;t<=K;t++){ for(int i=0;i<N;i++){ //街iで終わる chmin(ans,dp[(1<<N)-1][i][t]+dist(pos[i],{0,0})); } } printf("%.10f\n",ans); }