#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
const double EPS = 1e-7;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}
#ifdef DEBUG
#define OUTPUT(x) (output(x), output("\n"))
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
    ll res = 1;
    while(b){
        if(b&1)res = res * x % MOD;
        x = x * x % MOD;
        b>>=1;
    }
    return res;
}

ll modinv(ll x){
    return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
    if(was_output)cout << " ";
    cout << a;
    was_output = true;
}
void outendl(){
    was_output = false;
    cout << endl;
}
ll in(){
    ll res;
    scanf("%lld", &res);
    return res;
}

template<class t>
istream& operator>>(istream& is, vector<t> &x){
    for(auto &i:x)is >> i;
    return is;
}

template<class t, class u>
istream& operator>>(istream& is, pair<t, u> x){
    is >> x.first >> x.second;
    return is;
}

using P =complex<double>;

int n;
int k;
vector<P> niku;
vector<double> need;

void input(){
    n = in();
    k = in();
    niku.resize(n);
    need.resize(n);
    rep(i,n){
        double a = in();
        double b = in();
        niku[i] = P(a,b);
        need[i] = in();
    }
}

P polar(double a,double r){
    return P(cos(r)*a,sin(r)*a);
}

vector<P> getcross(P c1,P c2,double r1,double r2){
    double d = abs(c1-c2);
    if(d>r1+r2)return vector<P>(0);
    double a = acos((r1*r1+d*d-r2*r2)/(2*r1*d));
    double t = arg(c2-c1);
    vector<P> res(2);
    res[0] = c1 + polar(r1,t+a);
    res[1] = c1 + polar(r1,t-a);
    return res;
}

bool func(double time){
    rep(i,n){
        for(int j=i+1;j<n;++j){
            vector<P> crossp = getcross(niku[i],niku[j],time/need[i],time/need[j]);
            if(crossp.empty())continue;
            int cnt = 0;
            rep(k,n){
                if(abs(crossp[0]-niku[k])<=time/need[k]+EPS){
                    ++cnt;
                }
            }
            if(cnt>=k)return true;
            cnt = 0;
            rep(k,n){
                if(abs(crossp[1]-niku[k])<=time/need[k]+EPS){
                    ++cnt;
                }
            }
            if(cnt>=k)return true;
        }
        int cnt = 0;
        rep(k,n){
            if(abs(niku[i]-niku[k])<=time/need[k]+EPS){
                ++cnt;
            }
        }
        if(cnt>=k)return true;
    }
    return false;
}

int main(){
    input();
    double lp = 0;
    double rp = 1e7;
    while(rp-lp>EPS){

        double mid = (lp+rp) / 2;
        if(func(mid)){
            rp = mid;
        }else{
            lp = mid;
        }
    }

    printf("%.10lf\n",lp);
    return 0;
}


Measured memory_bytes: 384