#include <cstdio>
#include <complex>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

typedef complex<double> point_t;
typedef pair<point_t,double> circle_t;

const double eps=1e-9;

circle_t cs[62];
point_t meats[62];
double hardness[62];

int N,K;

void add_intersect(const circle_t & c1,const circle_t & c2,vector<point_t> & v){
    auto d=abs(c1.first-c2.first);
    auto rc=(d*d+c1.second*c1.second-c2.second*c2.second)/(2*d);
    auto diff=c1.second*c1.second-rc*rc;

    if (abs(diff)<eps) diff=0.;

    if (diff<0.) return;
    auto rs=sqrt(diff);

    auto dir=(c2.first-c1.first)/d;

    if (diff==0.) v.push_back(c1.first+dir*point_t(rc,rs));
    else {
        v.push_back(c1.first+dir*point_t(rc,rs));
        v.push_back(c1.first+dir*point_t(rc,-rs));
    }
}

int cnt(const point_t &  p){
    int ret=0;

    for(int i=1;i<=N;i++){
        // printf("r=%lf\n",cs[i].second);
        auto dist=abs(cs[i].first-p);
        // printf("dist=%lf\n",dist);
        if (dist < cs[i].second + eps) ret++;
    }
    // printf("pos=%lf,%lf ret=%d\n",p.real(),p.imag(),ret);
    return ret;
}

bool valid(){
    vector<point_t> candidate;
    for(int i=1;i<=N;i++) candidate.push_back(meats[i]);

    for(int i=1;i<=N;i++)
        for(int j=i+1;j<=N;j++)
             add_intersect(cs[i],cs[j],candidate);

    for(auto &p:candidate) if (cnt(p)>=K) return true;

    return false;
}

int main(){
    scanf("%d%d",&N,&K);
    for(int i=1;i<=N;i++){
        double x,y,c;
        scanf("%lf%lf%lf",&x,&y,&c);
        meats[i]=point_t(x,y);
        hardness[i]=c;

    }
    
    double l=0.0,r=1e6;
    double ans=r;
    for(int i=1;i<100;i++){
        auto mid=(l+r)/2.;
        for(int i=1;i<=N;i++)
            cs[i]=circle_t(meats[i],mid/hardness[i]);

        if (valid()) r=mid,ans=mid;
        else l=mid;
    }

    printf("%.7lf\n",r);
    return 0;
}