#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n, k; cin >> n >> k; vector> xy(n); for (int i = 0; i < n; i++) { cin >> xy[i].first >> xy[i].second; } using ld = long double; vector> dist(n, vector(n)); vector dist_org(n); for (int i = 0; i < n; i++) { dist_org[i] = hypotl(xy[i].first, xy[i].second); for (int j = 0; j < n; j++) { dist[i][j] = hypotl(xy[i].first - xy[j].first, xy[i].second - xy[j].second); } } vector>> dp(1 << n, vector>(n, vector(k, 9e18))); for (int i = 0; i < n; i++) { dp[1 << i][i][k - 1] = dist_org[i]; } for (int st = 0; st < (1 << n); st++) { for (int cur = 0; cur < n; cur++) { for (int rem = 0; rem < k; rem++) { for (int nxt = 0; nxt < n; nxt++) { if (st & (1 << nxt)) continue; if (rem > 0) { dp[st | (1 << nxt)][nxt][rem - 1] = min(dp[st | (1 << nxt)][nxt][rem - 1], dp[st][cur][rem] + dist[cur][nxt]); } dp[st | (1 << nxt)][nxt][k - 1] = min(dp[st | (1 << nxt)][nxt][k - 1], dp[st][cur][rem] + dist_org[nxt] + dist_org[cur]); } } } } ld ans = 9e18; for (int cur = 0; cur < n; cur++) { for (int rem = 0; rem < k; rem++) { ans = min(ans, dp[(1 << n) - 1][cur][rem] + dist_org[cur]); } } cout << setprecision(16) << fixed << ans << endl; }