#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
#define pi M_PI
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<'\n';}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<'\n';}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<'\n';}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<'\n';}}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll modpow(ll a,ll b){a%=mod;if(b==0)return 1;if(b&1)return a*modpow(a,b-1)%mod;ll k=modpow(a,b/2);return k*k%mod;}
int main(){
    ll n,k;cin>>n>>k;
    vector<double> x(n);
    vector<double> y(n);
    vector<double> r(n);
    vector<double> t(n);
    rep(i,n)cin>>x[i]>>y[i]>>t[i];
    vvi v(2001,vi(2001));
    rep(i,n)v[x[i]+1000][y[i]+1000]++;
    ll ma=0;
    rep(i,2001)rep(j,2001)chmax(ma,v[i][j]);
    if(ma>=k){
        out(0);
        return 0;
    }
    double ok=500000,ng=0;
    while(ok-ng>0.00000001){
    vector<double> xx=x,yy=y;
    double md=(ok+ng)/2;
    rep(i,n)r[i]=md/t[i];
    rep(c1,n){
        rep(c2,n){
            double dist_x = x[c1] - x[c2];
            dist_x*=dist_x; //自乗
            double dist_y = y[c1] - y[c2];
            dist_y*=dist_y;
            double dist = sqrt(dist_x+dist_y);
            if(!(dist <= (r[c1] + r[c2]) && dist >= fabs(r[c1]-r[c2])))continue;
            double a = (x[c2]-x[c1]);
            double b = (y[c2]-y[c1]);
            double c = (x[c1] * x[c1] + y[c1] * y[c1] - r[c1] * r[c1] - (x[c2] * x[c2] + y[c2] * y[c2] - r[c2] * r[c2]))/2;
            double d = a*x[c1]+b*y[c1]+c;
            double tmp=sqrt((a*a+b*b)*r[c1]*r[c1]-d*d);
            xx.pb((-a*d+b*tmp)/(a*a+b*b)+x[c1]);
            xx.pb((-a*d-b*tmp)/(a*a+b*b)+x[c1]);
            yy.pb((-b*d-a*tmp)/(a*a+b*b)+y[c1]);
            yy.pb((-b*d+a*tmp)/(a*a+b*b)+y[c1]);
        }
    }
    bool b=false;
    rep(i,xx.size()){
        ll num=0;
        double X=xx[i],Y=yy[i];
        rep(j,n){
            double dist_x = x[j] - X;
            dist_x*=dist_x; //自乗
            double dist_y = y[j] - Y;
            dist_y*=dist_y;
            double dist = sqrt(dist_x+dist_y);
            if(dist-0.0000001<=r[j])num++;
        }
        //cout<<md<<' '<<num<<endl;
        if(num>=k){
            b=true;
            break;
        }
    }
    if(b)ok=md;
    else ng=md;
    }
    cout<<fixed<<setprecision(10);
    out(ok);
}

Measured memory_bytes: 31780