#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

//-------------------------------------------------
//--Geometry (Plane)
//-------------------------------------------------

using lf = double;
const lf EPS = 1e-7;

#define sgn(x) (((x)<-EPS)?-1:((x)>EPS)?1:0)
#define EQ(x,y) (sgn((y)-(x))==0)

struct V {
    lf x,y;
    V(){}
    V(lf x, lf y):x(x),y(y){}
    V(const V &v):x(v.x),y(v.y){}
    V& operator+=(V &v){x+=v.x; y+=v.y; return *this;}
    V& operator-=(V &v){x-=v.x; y-=v.y; return *this;}
    V& operator*=(lf k){x*=k; y*=k; return *this;}
    V& operator/=(lf k){x/=k; y/=k; return *this;}
    V operator+(V &v){return V(*this)+=v;}
    V operator-(V &v){return V(*this)-=v;}
    V operator*(lf k){return V(*this)*=k;}
    V operator/(lf k){return V(*this)/=k;}
    V operator-(){return V(-x,-y);}
    lf sq(){return x*x+y*y;}
    lf norm(){return sqrt(sq());}
    V unit(){return V(*this)/=norm();}
    lf arg(){return atan2(y,x);}
    V rot(lf c, lf s){return V(x*c-y*s,x*s+y*c);}
    V rot(lf a){return rot(sin(a),cos(a));}
    V rot90(){return V(-y,x);}
    bool operator<(const V &v){return x<v.x;}
};

lf dot(V &v1, V &v2){return v1.x*v2.x+v1.y*v2.y;}
lf det(V &v1, V &v2){return v1.x*v2.y-v1.y*v2.x;}

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n,k; cin>>n>>k;
    vector<V> ps(n);
    vector<lf> c(n);
    rep(i,n) cin>>ps[i].x>>ps[i].y>>c[i];
    lf l=0.0, r=1e6;
    rep(_,100){
        lf t = (l+r)/2;
        vector<V> event;
        rep(i,n) event.pb(ps[i]);
        rep(i,n)FOR(j,i+1,n-1){
            V v = ps[j]-ps[i];
            lf r1 = t/c[i], r2 = t/c[j];
            lf d = v.norm(), d2 = v.sq();
            lf c = (r1*r1+d2-r2*r2)/(2.0*r1*d);
            if (sgn(abs(c)-1.0)>0) continue;
            if (EQ(abs(c),1.0)){
                c = (c>0)?1:-1;
                auto res = v.unit().rot(c,0)*r1;
                event.pb(res+ps[i]);
                continue;
            }
            lf s = sqrt(1.0-c*c);
            auto res = v.unit().rot(c,s)*r1;
            event.pb(res+ps[i]);
            res = v.unit().rot(c,-s)*r1;
            event.pb(res+ps[i]);
        }
        int val=0;
        for(auto e:event){
            int cnt=0;
            rep(i,n){
                auto u = e-ps[i];
                lf r = t/c[i];
                if (sgn(u.sq()-r*r)<=0) cnt++;
            }
            chmax(val,cnt);
        }
        if (val>=k) r = t;
        else l = t;
    }
    cout<<setp(12)<<(l+r)/2<<endl;
    return 0;
}


Measured memory_bytes: 384