#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; vector> a(n); for(auto &&[x, y] : a) cin >> x >> y; vector dp(1 << n, 1ll << 60); array tmp; tmp.fill(1ll << 60); vector> dp2(1 << n, tmp); auto calc = [&](int x1, int y1, int x2, int y2){ ll dx = x2 - x1, dy = y2 - y1; return sqrt(dx * dx + dy * dy); }; for(int i = 0; i < n; i++){ dp2[1 << i][i] = calc(0, 0, a[i].first, a[i].second); } for(int S = 1; S < (1 << n); S++){ int popcnt = __builtin_popcount(S); if(popcnt <= k){ double mn = 1ll << 60; for(int i = 0; i < n; i++){ if(~S >> i & 1) continue; mn = min(mn, dp2[S][i] + calc(0, 0, a[i].first, a[i].second)); if(popcnt < k){ for(int j = 0; j < n; j++){ dp2[S | (1 << j)][j] = min(dp2[S | (1 << j)][j], dp2[S][i] + calc(a[i].first, a[i].second, a[j].first, a[j].second)); } } } dp[S] = mn; }else{ for(int T = (S - 1) & S; T > 0; T = (T - 1) & S){ dp[S] = min(dp[S], dp[T] + dp[S ^ T]); } } } cout << fixed << setprecision(15) << dp.back() << '\n'; }