#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

using R = long double; // Rにmint渡せるようにする
using P = complex<R>;
using L = pair<P,P>;
using G = vector<P>;
struct C {
    P c; R r;
    C() {}
    C(const P &a, const R &b) : c(a), r(b) {}
};
struct S : public L {
    S() {}
    S(const P &a, const P &b) : L(a,b) {}
};

const R EPS = 1e-8;
const R PI = atan(1)*4;

inline int sgn(const R& r) { return (r>EPS) - (r<-EPS); }
inline R dot(const P& a, const P& b) {
    return real(a)*real(b) + imag(a)*imag(b);
}
inline R det(const P& a, const P& b) {
    return real(a)*imag(b) - imag(a)*real(b);
}
inline P rotate(const P& p, const R& arg) {
    return P(cos(arg)*p.real()-sin(arg)*p.imag(),
             sin(arg)*p.real()+cos(arg)*p.imag());
}
inline P vec(const L& l) {return l.second - l.first;}
namespace std {
	bool operator < (const P& a, const P& b) {
		return sgn(real(a-b)) ? real(a-b) < 0 : sgn(imag(a-b)) < 0;
	}
	bool operator == (const P& a, const P& b) {
		return sgn(real(a-b)) == 0 && sgn(imag(a-b)) == 0;
	}
    bool cmp_y (const P& a, const P& b) {
        return sgn(imag(a-b)) ? imag(a-b) < 0 : sgn(real(a-b)) < 0;
    }
}

// P,L,Sについて入力
inline istream& operator>>(istream& is, P& p) {
    R x, y;
    is >> x >> y;
    p = P(x, y);
    return is;
}
inline istream& operator>>(istream& is, L& l) {
    P a, b;
    is >> a >> b;
    l = L(a, b);
    return is;
}
inline istream& operator>>(istream& is, S& s) {
    P a, b;
    is >> a >> b;
    s = S(a, b);
    return is;
}

// 線分abから見たcの位置
enum CCW{LEFT=1, RIGHT=2, BACK=4, FRONT=8, ON_SEG=16};
int ccw(P a, P b, P c) {
	P p = (c-a)/(b-a);
	if(sgn(imag(p)) > 0) return LEFT;
	if(sgn(imag(p)) < 0) return RIGHT;
	if(sgn(real(p)) < 0) return BACK;
	if(sgn(real(p)-1) > 0) return FRONT;
	return ON_SEG;
}

// 射影
P inline projection(const L &l, const P &p) {
    R t = dot(p-l.first, l.first-l.second) / norm(l.first-l.second);
    return l.first + t*(l.first-l.second);
}
// 反射
P inline reflection(const L &l, const P &p) {
    return p + (R)2 * (projection(l, p) - p);
}

// 垂直,平行
inline bool vertical(L a, L b) {return sgn(dot(vec(a), vec(b))) == 0;}
inline bool parallel(L a, L b) {return sgn(det(vec(a), vec(b))) == 0;}

// 交差判定
template<bool strict=false> inline bool intersect(const L&l1, const L&l2) {
    if(strict) return sgn(det(vec(l1),vec(l2))) != 0;
    return sgn(det(vec(l1),vec(l2))) != 0 || l1 == l2;
}
template<bool strict=false> inline bool intersect(const L&l, const S&s) {
    if(strict) det(s.first, vec(l)) * det(s.second, vec(l)) < 0;
    return det(s.first, vec(l)) * det(s.second, vec(l)) <= 0;
}
template<bool strict=false> inline bool intersect(const S&s1, const S&s2) {
    int ccw1 = ccw(s1.first, s1.second, s2.first) | ccw(s1.first, s1.second, s2.second);
    int ccw2 = ccw(s2.first, s2.second, s1.first) | ccw(s2.first, s2.second, s1.second);
    if(strict) return (ccw1 & ccw2) == (LEFT | RIGHT);
    return (ccw1 & ccw2) == (LEFT | RIGHT) || ((ccw1 | ccw2) & ON_SEG);
}
template<bool strict=false> inline bool intersect(const S&s, const P&p) {
    return ccw(s.first, s.second, p) == ON_SEG;
}
template<bool strict=false> inline bool intersect(const L&l, const P&p) {
    return ccw(l.first, l.second, p) == ON_SEG ||
            ccw(l.first, l.second, p) == FRONT ||
            ccw(l.first, l.second, p) == BACK;
}

// 距離
R dist(const S& s, const P& p) {
    P q = projection(s, p);
    if(sgn(dot(s.second-s.first, p-s.first)) <= 0) q = s.first;
    if(sgn(dot(s.first-s.second, p-s.second)) <= 0) q = s.second;
    return abs(p-q);
}
R dist(const S& a, const S& b) {
    if(intersect(a, b)) return 0;
    return min({dist(a, b.first), dist(a, b.second), dist(b, a.first), dist(b, a.second)});
}
R dist(const L& l, const P& p) {
    P q = projection(l, p);
    return abs(p-q);
}

// 交点 交差判定を先にすること!!!
inline P crosspoint(const L& l1, const L& l2) {
    R ratio = det(vec(l2), l2.first-l1.first)/det(vec(l2),vec(l1));
    return l1.first + vec(l1)*ratio;
}

// 交差
int intersect(const C& a, const C& b) {
	R dist = norm(a.c-b.c), r1 = (a.r+b.r)*(a.r+b.r), r2 = (a.r-b.r)*(a.r-b.r);
	if(sgn(r1-dist) < 0)  return 4;	// 円が離れている
	if(sgn(r1-dist) == 0) return 3;	// 外接
	if(sgn(r2-dist) < 0 && sgn(dist-r1) < 0) return 2; // 交差
	if(sgn(dist-r2) == 0) return 1; // 内接
	return 0;	// 内部に含む
}
// intersect=2 を確認すること
vector<P> crosspoint(C a, C b) {
    R d = abs(a.c-b.c);
    R t = (a.r*a.r-b.r*b.r+d*d)/2/d, h = sqrt(a.r*a.r-t*t);
    P m = t/abs(b.c-a.c)*(b.c-a.c)+a.c;
    P n(-(a.c-b.c).imag()/abs(a.c-b.c), (a.c-b.c).real()/abs(a.c-b.c));
    vector<P> ret(2, m);
    ret[0] -= h*n; ret[1] += h*n;
    return ret;
}


int main(void) {
    ll n, m;
    cin >> n >> m;
    vector<ll> x(n), y(n), c(n);
    REP(i, n) cin >> x[i] >> y[i] >> c[i];

    auto check = [&](R mid) {
        vector<C> cs(n);
        REP(i, n) cs[i] = {{(R)x[i], (R)y[i]}, mid/(R)c[i]};

        vector<P> ps;
        REP(i, n) ps.push_back({(R)x[i], (R)y[i]});
        REP(i, n) FOR(j, i+1, n) {
            ll type = intersect(cs[i], cs[j]);
            // dump(i, j, type);
            if(type == 2) {
                auto tps = crosspoint(cs[i], cs[j]);
                // dump(tps);
                for(P p: tps) ps.push_back(p);
            } else if(type == 3) {
                R coff = cs[i].r / (cs[i].r + cs[j].r);
                P v = cs[j].c - cs[i].c;
                P mp = cs[i].c + coff * v;
                // dump(mp);
                ps.push_back(mp);
            }
        }
        // dump(ps);

        for(P p: ps) {
            ll cnt = 0;
            REP(i, n) {
                R d = abs(p-cs[i].c);
                if(sgn(cs[i].r-d) >= 0) {
                    cnt++;
                }
            }
            // dump(p, cnt);
            if(cnt >= m) return true;
        }
        return false;
    };

    // bool ret = check(2.4);
    // dump(ret);

    R lb = 0, ub = INF;
    REP(i, 150) {
        R mid = (lb+ub)/2;
        dump(lb, mid, ub);
        if(check(mid)) ub = mid;
        else lb = mid;
    }
    cout << fixed << setprecision(9) << lb << endl;

    return 0;
}

Measured memory_bytes: 384