#include //#include using namespace std; //using namespace atcoder; //using mint = modint1000000007; //const int mod = 1000000007; //using mint = modint998244353; //const int mod = 998244353; //const int INF = 1e9; const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n) - 1; i >= 0; --i) #define rrep2(i,l,r)for(int i=(r) - 1;i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define P pair template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m; cin >> n >> m; vector>pos(n + 1); rep(i, n)cin >> pos[i + 1].first >> pos[i + 1].second; n++; vector d(n, vector(n)); rep(i, n)rep(j, n) { double dx = pos[i].first - pos[j].first; double dy = pos[i].second - pos[j].second; d[i][j] = sqrt(dx * dx + dy * dy); } vector dp(1 << n, vector(n, vector(m + 1, LINF))); dp[1 << 0][0][m] = 0; rep(i, 1 << n)rep(j, n)rep(k, m + 1) { if (LINF == dp[i][j][k])continue; rep2(nj, 1, n) { if (1 & (i >> nj))continue; int ni = i + (1 << nj); if (0 != k) { int nk = k - 1; auto nval = dp[i][j][k] + d[j][nj]; chmin(dp[ni][nj][nk], nval); } { int nk = m - 1; auto nval = dp[i][j][k] + d[j][0] + d[0][nj]; chmin(dp[ni][nj][nk], nval); } } } double ans = LINF; rep(j, n)rep(k, m + 1) { auto tmp = dp[(1 << n) - 1][j][k]; tmp += d[j][0]; chmin(ans, tmp); } cout << fixed << setprecision(16) << ans << endl; return 0; }