#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <random>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int, int> pii;
typedef double db;
mt19937 mrand(random_device{}());
const ll mod = 1000000007;
int rnd(int x) { return mrand() % x; }
ll powmod(ll a, ll b) { ll res = 1; a %= mod; assert(b >= 0); for (; b; b >>= 1) { if (b & 1)res = res * a%mod; a = a * a%mod; }return res; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
// head

//#define RG
const long double eps = 1e-8;
typedef long double ld;
int t;
struct Point {
    Point() {}
    Point(ld xx, ld yy): x(xx),y(yy) {}
    long double x,y;
}pts[100];
int c[100];

ld getDis(Point& a, Point& b) {
    return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));
}

Point calPointInDirAndDis(Point from, ld dis, Point to) {
    Point ans;
    if(abs(getDis(from,to)) <eps) return from;
    ld _ratio = dis/getDis(from,to);
    ans.x = from.x + _ratio*(to.x-from.x);
    ans.y = from.y + _ratio*(to.y-from.y);
    return ans;
}

vector<Point> getCrossPoint(long double T, int i, int j) {
    ld ri = T/c[i];
    ld rj = T/c[j];
    ld dd = getDis(pts[i],pts[j]);
    //cout<<"ririri:"<<ri<<endl;
    //cout<<"rjrjrj:"<<rj<<endl;
    //没有交点，且大的圆包含小的圆，返回大的圆的圆心
    if(abs(ri-rj)>dd && abs(abs(ri-rj)-dd) > eps) {
        vector<Point> ans;
        ans.push_back(pts[i]);
        ans.push_back(pts[j]);
        return ans;
    }
    //没有交点，两个圆无包含关系
    if(abs(ri+rj)<dd && abs(ri+rj-dd) > eps) {
        return vector<Point>{pts[i],pts[j]};
    }
    ld ao = (ri*ri-rj*rj+dd*dd)/(2.0*dd);
    Point o = calPointInDirAndDis(pts[i], ao, pts[j]);
    ld co=0.0;
    //cout<<"aoaoao:"<<ao<<endl;
    //if(ri*ri-ao*ao < 0 || abs(ri*ri-ao*ao) < eps)
    if(ri*ri-ao*ao < 0 )
        return vector<Point>{pts[i],pts[j]};
    co = sqrt(ri*ri-ao*ao);
    Point c,d;
    c.x = o.x + (pts[j].y-pts[i].y);
    c.y = o.y - (pts[j].x-pts[i].x);
    d.x = o.x - (pts[j].y-pts[i].y);
    d.y = o.y + (pts[j].x-pts[i].x);
    //cout<<"OOOOOO:"<<o.x<<","<<o.y<<endl;
    //cout<<"cococo:"<<co<<endl;
    c = calPointInDirAndDis(o, co, c);
    d = calPointInDirAndDis(o, co, d);
    vector<Point> ans;
    ans.push_back(c);
    ans.push_back(d);
    return ans;
}
Point operator*(const Point& a, const Point &p) { return Point(a.x * p.x + (-a.y * p.y), (a.x * p.y +  a.y * p.x)); }
Point operator+(const Point& a, const Point &p) { return Point(a.x + p.x , a.y + p.y); }
vector<Point> getCrossPoint2(Point a, Point b, double Ra, double Rb) {
    //double d = (a - b).norm();
    double d = getDis(a,b);
    double rc = (d * d + Ra * Ra - Rb * Rb) / (2 * d);
    double rs = sqrt(Ra * Ra - rc * rc);
    Point diff;
    diff.x  = (b.x - a.x) / d;
    diff.y  = (b.y - a.y) / d;
    //return {a + diff * Point(rc, rs), a + diff * Point(rc, -rs)};
    vector<Point> ans;
    return {a + diff * Point(rc, rs), a + diff * Point(rc, -rs)};
}
int disLessTciNum(Point p, int n, ld T) {
    int cnt = 0;
    for(int i=0;i<n;++i) {
        //if(getDis(p, pts[i])<=T/c[i] || abs(getDis(p, pts[i])-T/c[i]) < eps) cnt++;
        if(getDis(p, pts[i])<=(T/c[i]+eps)) cnt++;
    }
    //cout<<"cnt::"<<cnt<<endl;
    return cnt;
}

Point anspt;
bool getCount(long double T,int n, int k) {
    rep(i,0,n) {
        rep(j,0,n) {
            //vector<Point> crossPts{pts[i]};
            vector<Point> crossPts;
            if(i!=j) {
                crossPts = getCrossPoint(T, i, j);
                //vector<Point> crossPts = getCrossPoint2(pts[i], pts[j], T/c[i], T/c[j]);
                //cout<<"crossPts0:"<<crossPts[0].x<<","<<crossPts[0].y<<endl;
                //cout<<"crossPts1:"<<crossPts[1].x<<","<<crossPts[1].y<<endl;
            }
            if(crossPts.size()==0) continue;
            if(disLessTciNum(crossPts[0],n,T) >= k) {
                anspt = crossPts[0];
                return true;
            }
            if(disLessTciNum(crossPts[1],n,T) >= k) {
                anspt = crossPts[1];
                return true;
            }
        }
    }
    return false;
}

int main()
{
    ios::sync_with_stdio(false);
#ifdef RG
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout); 
#endif
    int n,k;
    cin>>n>>k;
    rep(i,0,n) {
        cin>>pts[i].x>>pts[i].y;
        cin>>c[i];
    }
    if(k==1) cout<<0<<endl;
    else {
        long double lt = 0.0,rt = 4000.0*100;
        while(abs(rt-lt) > eps) {
            long double mt = (lt+rt)/2;
            //cout<<"mt:::"<<mt<<endl;
            if(getCount(mt,n,k) ) {
                rt = mt;
            } else {
                lt = mt;
            }
        }
        //cout<<lt<<endl;
        printf("%.20Lf\n", lt);
    }
    return 0;
}

Measured memory_bytes: 256