#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) {}
    ld x,y;
}pts[100];
int c[100];

inline 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(ld ri, ld rj, 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) {
        vector<Point> ans;
        if(ri>rj) {
            ans.push_back(pts[i]);
            ans.push_back(pts[j]);
        }
        else {
            ans.push_back(pts[i]);
            ans.push_back(pts[j]);
        }
        return ans;
    }
    //没有交点，两个圆无包含关系
    if(ri+ri<dd) {
        return vector<Point>();
    }
    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)
        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;
}
static ld add_w_error(ld a, ld b) { return (abs(a + b) < eps* (abs(a) + abs(b))) ? 0 : a + b; }
Point operator*(const Point& a, const Point &p) { return Point(add_w_error(a.x * p.x, (-a.y * p.y)), add_w_error(a.x * p.y,  a.y * p.x)); }
Point operator+(const Point& a, const Point &p) { return Point(add_w_error(a.x, p.x) , add_w_error(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  = add_w_error(b.x, - a.x) / d;
    diff.y  = add_w_error(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)};
}
ld r[100];
inline int disLessTciNum(Point p, int n) {
    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])<=(r[i]+eps)) cnt++;
    }
    //cout<<"cnt::"<<cnt<<endl;
    return cnt;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(20);
#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];
    }
    //long double lt = 0.0,rt = 4000.0*100;
    long double lt = 0.0,rt = 1.0e9;
    //while(abs(rt-lt) > eps) {
    rep(i,0,100) {
        long double mt = (lt+rt)/2;
        rep(j,0,n) r[j] = mt/c[j];
        //cout<<"mt:::"<<mt<<endl;
        if(getCount(n,k) ) {
            rt = mt;
        } else {
            lt = mt;
        }
    }
    cout<<lt<<endl;
    //printf("%.20Lf\n", lt);
    return 0;
}

Measured memory_bytes: 256