#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#include<cmath>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)

#define int long long
#define double long double
int N, K;
vector<int> X;
vector<int> Y;
double calc(double x, double y){
    vector<double> v(N);
    for(int i=0;i<N;i++){
        v[i] = hypot(X[i] - x, Y[i] - y);
    }
    sort(v.rbegin(),v.rend());
    double res = 0;
    for(int i=0;i<K;i++){
        res+=v[i];
    }
    return res;
}
signed main(){
    cin >>N>>K;
    X.resize(N);
    Y.resize(N);
    for(int i=0;i<N;i++){
        cin >> X[i] >> Y[i];
    }
    double xu,xd,yu,yd;

    xu=2000;
    xd=-2000;
    for(int i=0;i<100;i++){
        double xm1 = (xu*2+xd)/3;
        double xm2 = (xu+xd*2)/3;
        yu = 2000;
        yd = -2000;
        for(int j=0;j<100;j++){
            double ym1 = (yu*2+yd)/3;
            double ym2 = (yu+yd*2)/3;
            if(calc(xm1, ym1) < calc(xm1, ym2)){
                yd=ym2;
            }else{
                yu=ym1;
            }
        }
        double m1 = calc(xm1, (yu + yd)/2);
        yu = 2000;
        yd = -2000;
        for(int j=0;j<100;j++){
            double ym1 = (yu*2+yd)/3;
            double ym2 = (yu+yd*2)/3;
            if(calc(xm2, ym1) < calc(xm2, ym2)){
                yd=ym2;
            }else{
                yu=ym1;
            }
        }
        double m2 = calc(xm2, (yu + yd)/2);
        if(m1 < m2){
            xd=xm2;
        }else{
            xu=xm1;
        }

    }

    double res = calc((xu + xd)/2, (yu + yd)/2);
    //cerr << xu <<  " " << xd<<endl;
    cout << fixed << setprecision(15) <<  res<<endl;
    return 0;
}
