#include <bits/stdc++.h>
using namespace std;
///////////////////////////////////////////
const long long int INF = 1LL<<60;
const long long int Mod = 1000000007;
using ll = long long int; using ci = const int;
using vi = vector<int>;  using Vi = vector<long long int>;
using P = pair<int, int>;  using PLL = pair<ll, ll>;
using matrix = vector<vector<ll>>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define all(x) (x).begin(),(x).end()
#define rp(i,N) for(ll i = 0; i < (ll)N; i++)
#define repi(i,a,b) for(ll i = ll(a); i < ll(b); ++i)
template<class T>bool chmax(T &former, const T &b) { if (former<b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define p_queue(v) priority_queue<v, vector<v>, greater<v> >
template<class T> inline void princ(T x){cout<<x<<" ";}; 
template<class T> inline void print(T x){cout<<x<<"\n";};
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
///////////////////////////////////////////////////////////////////////////////////
const double eps=1e-6;
using PD=pair<double,double>;
pair<double,double> squequ(double a,double b,double c){
    if(b*b-4*a*c<0) return make_pair(-1e50,-1e50);
    if(abs(a)<eps) return make_pair(-c/b,1e-50);
    double s=sqrt(b*b-4*a*c);
    return make_pair((-b+s)/(2*a),(-b-s)/(2*a));
}
pair<pair<double,double>,pair<double,double>> seven(double a,double b,double c,double d,double f,double g, double h){
    pair<double,double> p=squequ(a*(1+f*f/g/g),b-c*f/g+2*a*f*h/g/g,a*h*h/g/g-c*h/g+d);
    double y1,y2;
    if(p.first>-1e49){
        y1=(-f/g)*p.first-h/g;
    }else{
        y1=-1e50;
    }
    if(p.second>-1e49){
        y1=(-f/g)*p.second-h/g;
    }else{
        y2=-1e50;
    }
    return mp(mp(p.first,y1),mp(p.second,y2));
}
pair<pair<double,double>,pair<double,double>> eight(double a,double b,double c,double d,double e,double f,double g,double h){
    if(abs(e)<eps){
        if(abs(g)<eps){
            pair<double,double> py=squequ(a,c,a*h*h/f/f-b*h/f+d);
            return mp(mp(-h/f,py.first),mp(-h/f,py.second));
        }else{
            return seven(a,b,c,d,f,g,h);
        }
    }else{
        return seven(a,b,c,d,b-f*a/e,c-g*a/e,d-h*a/e);
    }
}
double distance(double x1,double y1,double x2,double y2){
    return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
}
pair<PD,PD> circle_cross(double x1,double y1,double r1,double x2,double y2,double r2){
    double vecX=x2-x1, vecY=y2-y1;
    double D=distance(x1,y1,x2,y2);
    double hX,hY;
    double a,b;
    a=(D*D-r2*r2+r1*r1)/(2.0*D);
    b=sqrt(r1*r1-a*a);
    hX=x1+(a/D)*vecX; hY=y1+(a/D)*vecY;
    return mp(mp(hX-(b/D)*vecY,hY+(b/D)*vecX),mp(hX+(b/D)*vecY,hY-(b/D)*vecX));
}
void solve(){
    ll n,k;
    cin >> n >> k;
    vector<double> x(n),y(n),c(n);
    rp(i,n) cin >> x.at(i) >> y.at(i) >> c.at(i);
    double ans=1e50;
    if(k==1){
        print(0);
        return;
    }
    rp(i,n){
        repi(j,i+1,n){
            double X=(c[i]*x[i]+c[j]*x[j])/(c[i]+c[j]);
            double Y=(c[i]*y[i]+c[j]*y[j])/(c[i]+c[j]);
            vector<double> time(n);
            rp(t,n){
                time[t]=c[t]*sqrt((X-x[t])*(X-x[t])+(Y-y[t])*(Y-y[t]));
            }
            sort(all(time));
            chmin(ans,time[k-1]);
        }
    }
    rp(i,n){
        repi(j,i+1,n){
            repi(t,j+1,n){
                pair<pair<double,double>,pair<double,double>> pp;
                if(c[i]==c[j]&&c[j]==c[t]){
                    if(abs((x[j]-x[i])*(y[t]-y[j])-(x[t]-x[j])*(y[j]-y[i]))<eps) continue;
                    double A=x[j]-x[i],B=y[j]-y[i],C=(x[j]*x[j]-x[i]*x[i]+y[j]*y[j]-y[i]*y[i])/2.0,D=x[t]-x[j],E=y[t]-y[j],F=(x[t]*x[t]-x[j]*x[j]+y[t]*y[t]-y[j]*y[j])/2.0;
                    pp=mp(mp((C*E-B*F)/(A*E-D*B),(A*F-C*D)/(A*E-B*D)),mp(-1e50,-1e50));
                }else if(c[i]==c[j]){
                    double x1=(-c[j]*c[j]*x[j]+c[t]*c[t]*x[t])/(c[t]*c[t]-c[j]*c[j]),
                    x2=(-c[i]*c[i]*x[i]+c[t]*c[t]*x[t])/(c[t]*c[t]-c[i]*c[i]),
                    y1=(-c[j]*c[j]*y[j]+c[t]*c[t]*y[t])/(c[t]*c[t]-c[j]*c[j]),
                    y2=(-c[i]*c[i]*y[i]+c[t]*c[t]*y[t])/(c[t]*c[t]-c[i]*c[i]),
                    r1=abs(c[j]*c[t]/(c[t]*c[t]-c[j]*c[j]))*distance(x[j],y[j],x[t],y[t]),
                    r2=abs(c[i]*c[t]/(c[t]*c[t]-c[i]*c[i]))*distance(x[i],y[i],x[t],y[t]);
                    pp=circle_cross(x1,y1,r1,x2,y2,r2);
                }else if(c[j]==c[t]){
                    double x1=(-c[j]*c[j]*x[j]+c[i]*c[i]*x[i])/(c[i]*c[i]-c[j]*c[j]),
                    x2=(-c[i]*c[i]*x[i]+c[t]*c[t]*x[t])/(c[t]*c[t]-c[i]*c[i]),
                    y1=(-c[j]*c[j]*y[j]+c[i]*c[i]*y[i])/(c[i]*c[i]-c[j]*c[j]),
                    y2=(-c[i]*c[i]*y[i]+c[t]*c[t]*y[t])/(c[t]*c[t]-c[i]*c[i]),
                    r1=abs(c[j]*c[i]/(c[i]*c[i]-c[j]*c[j]))*distance(x[j],y[j],x[i],y[i]),
                    r2=abs(c[i]*c[t]/(c[t]*c[t]-c[i]*c[i]))*distance(x[i],y[i],x[t],y[t]);
                    pp=circle_cross(x1,y1,r1,x2,y2,r2);
                }else{
                    double x1=(-c[j]*c[j]*x[j]+c[i]*c[i]*x[i])/(c[i]*c[i]-c[j]*c[j]),
                    x2=(-c[j]*c[j]*x[j]+c[t]*c[t]*x[t])/(c[t]*c[t]-c[j]*c[j]),
                    y1=(-c[j]*c[j]*y[j]+c[i]*c[i]*y[i])/(c[i]*c[i]-c[j]*c[j]),
                    y2=(-c[j]*c[j]*y[j]+c[t]*c[t]*y[t])/(c[t]*c[t]-c[j]*c[j]),
                    r1=abs(c[j]*c[i]/(c[i]*c[i]-c[j]*c[j]))*distance(x[j],y[j],x[i],y[i]),
                    r2=abs(c[j]*c[t]/(c[t]*c[t]-c[j]*c[j]))*distance(x[j],y[j],x[t],y[t]);
                    pp=circle_cross(x1,y1,r1,x2,y2,r2);

                }
                
                pair<double,double> p1,p2;
                p1=pp.first; p2=pp.second;
                double X=p1.first,Y=p1.second;
                vector<double> time(n);
                rp(r,n){
                    time[r]=c[r]*sqrt((X-x[r])*(X-x[r])+(Y-y[r])*(Y-y[r]));
                }
                sort(all(time));
                chmin(ans,time[k-1]);
                X=p2.first;Y=p2.second;
                rp(r,n){
                    time[r]=c[r]*sqrt((X-x[r])*(X-x[r])+(Y-y[r])*(Y-y[r]));
                }
                sort(all(time));
                chmin(ans,time[k-1]);
            }
        }
    }
    print(ans);
    return;
}
int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    std::cout<<std::fixed<<std::setprecision(30);
    solve();
    return 0;
}

Measured memory_bytes: 512