#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second


template<typename T> T chmax(T& a, const T& b){return a = (a > b ? a : b);}
template<typename T> T chmin(T& a, const T& b){return a = (a < b ? a : b);}

//----------基本部分-----------------------------------------------------------------------
#define X real()
#define Y imag()
#define x(p) real(p)
#define y(p) imag(p)
#define curr(P, i) P[i]
#define next(P, i) P[(i+1)%P.size()]
#define prev(P, i) P[(i+P.size()-1)%P.size()]

using D = double;

const D EPS = 1e-8;
const D INF = 1e12;
const D PI = acos(-1);
typedef complex<D> P;
typedef complex<D> point;
namespace std {
    bool operator < (const P& a, const P& b) {
        return x(a) != x(b) ? x(a) < x(b) : y(a) < y(b);
    }
}
D cross(const P& a, const P& b) {
    return y(conj(a)*b);
}
D dot(const P& a, const P& b) {
    return x(conj(a)*b);
}

struct L : public vector<P> {
    L(const P &a, const P &b) {
        push_back(a); push_back(b);
    }
};

typedef vector<P> G;
typedef vector<P> polygon;

struct C {
    P p; D r;
    C() { }

    C(const P &p, D r) : p(p), r(r) { }
};
//点の進行方向
int ccw(P a, P b, P c) {
    b -= a; c -= a;
    if (cross(b, c) > 0)   return +1;       // counter clockwise
    if (cross(b, c) < 0)   return -1;       // clockwise
    if (dot(b, c) < 0)     return +2;       // c--a--b on line
    if (norm(b) < norm(c)) return -2;       // a--b--c on line
    return 0;
}
//------------------------------------------------------------------------------------------
//---------交差判定・距離等-------------------------------------------------------------------
bool intersectLL(const L &l, const L &m) {
    return abs(cross(l[1]-l[0], m[1]-m[0])) > EPS || // non-parallel
            abs(cross(l[1]-l[0], m[0]-l[0])) < EPS;   // same line
}
bool intersectLS(const L &l, const L &s) {
    return cross(l[1]-l[0], s[0]-l[0])*       // s[0] is left of l
            cross(l[1]-l[0], s[1]-l[0]) < EPS; // s[1] is right of l
}
bool intersectLP(const L &l, const P &p) {
    return abs(cross(l[1]-p, l[0]-p)) < EPS;
}
bool intersectSS(const L &s, const L &t) {
  return ccw(s[0],s[1],t[0])*ccw(s[0],s[1],t[1]) <= 0 &&
         ccw(t[0],t[1],s[0])*ccw(t[0],t[1],s[1]) <= 0;
}
bool intersectSP(const L &s, const P &p) {
    return abs(s[0]-p)+abs(s[1]-p)-abs(s[1]-s[0]) < EPS; // triangle inequality
}
P projection(const L &l, const P &p) {
    D t = dot(p-l[0], l[0]-l[1]) / norm(l[0]-l[1]);
    return l[0] + t*(l[0]-l[1]);
}
P reflection(const L &l, const P &p) {
    return p + (D)2.0 * (projection(l, p) - p);
}
D distanceLP(const L &l, const P &p) {
    return abs(p - projection(l, p));
}
D distanceLL(const L &l, const L &m) {
    return intersectLL(l, m) ? 0 : distanceLP(l, m[0]);
}
D distanceLS(const L &l, const L &s) {
    if (intersectLS(l, s)) return 0;
    return min(distanceLP(l, s[0]), distanceLP(l, s[1]));
}
D distanceSP(const L &s, const P &p) {
    const P r = projection(s, p);
    if (intersectSP(s, r)) return abs(r - p);
    return min(abs(s[0] - p), abs(s[1] - p));
}
D distanceSS(const L &s, const L &t) {
    if (intersectSS(s, t)) return 0;
    return min(min(distanceSP(s, t[0]), distanceSP(s, t[1])),
            min(distanceSP(t, s[0]), distanceSP(t, s[1])));
}
P crosspoint(const L &l, const L &m) {
    D A = cross(l[1] - l[0], m[1] - m[0]);
    D B = cross(l[1] - l[0], l[1] - m[0]);
    if (abs(A) < EPS && abs(B) < EPS) return m[0]; // same line
    if (abs(A) < EPS) assert(false); // !!!PRECONDITION NOT SATISFIED!!!
    return m[0] + B / A * (m[1] - m[0]);
}

point makeP(D r, D arg) {return P(r*cos(arg), r*sin(arg));}
//点が円の中にあるか判定
bool contains(const P& p, const C& c) {
    return abs(p-c.p) < c.r+EPS;
}

// //円と円の交点を求める                                    CGL_7_E
// vector<P> crossPoint(const C& a, const C& b){
//     D d = abs(b.p-a.p);
//     D arg = atan2(y(b.p-a.p), x(b.p-a.p));
//     D arg2 = acos((d*d+a.r*a.r-b.r*b.r)/(2*d*a.r));
//     if(abs(arg2)<EPS) return {a.r*makeP(1.0, arg)+a.p};
//     if(abs(a.r-b.r)<d && d < a.r+b.r) return {a.r*makeP(1.0, arg+arg2)+a.p, a.r*makeP(1.0, arg-arg2)+a.p};
//     return {};
// }

vector<P> crossPoint(const C& a, const C& b) {
    vector<P> ret;
    D x1 = x(b.p-a.p), y1 = y(b.p-a.p);
    D r1 = a.r, r2 = b.r;;
    D A = (x1*x1+y1*y1+r1*r1-r2*r2)/2;
    D d = (x1*x1+y1*y1) * r1*r1 - A*A;
    if((x1*x1+y1*y1) <EPS) return {};
    if(d < -EPS) return {};
    if(d < 0) d = (D)0;
    ret.emplace_back((A*x1+y1*sqrt(d))/(x1*x1+y1*y1),  (A*y1-x1*sqrt(d))/(x1*x1+y1*y1));
    ret.emplace_back((A*x1-y1*sqrt(d))/(x1*x1+y1*y1),  (A*y1+x1*sqrt(d))/(x1*x1+y1*y1));
    rep(i, 2) {
        ret[i] += a.p;
    }
    return ret;
}

int main(){
    int n, k;
    cin >> n >> k;
    vector<P> p(n);
    vector<int> c(n);
    rep(i, n) {
        int x, y;
        cin >> x >> y >> c[i];
        p[i] = {(D)x, (D)y};
    }

    auto calc = [&](const vector<C>& cs) {
        rep(i, cs.size()) {
            {
                auto p = cs[i].p;
                // cout << p.X << " " << p.Y << endl;
                int cnt = 0;
                for(auto&& c : cs) if(contains(p, c)) ++cnt;
                if(cnt >= k) return true;
            }
        }
        rep(i, cs.size()) rep(j, i) {
            auto v = crossPoint(cs[i], cs[j]);
            for(auto&& p: v) {
                // cout << p.X << " " << p.Y << endl;
                int cnt = 0;
                for(auto&& c : cs) if(contains(p, c)) ++cnt;
                // assert(cnt >= 2);
                if(cnt >= k) return true;
            }
        }
        return false;
    };

    auto check = [&](D m) {
        vector<C> cs(n);
        rep(i, n) {
            cs[i] = C{p[i], m / c[i]};
        }
        return calc(cs);
    };
    D l = 0, r = 1e6;
    rep(_, 128) {
        D m = (l + r) / 2;
        if(check(m)) r = m;
        else l = m;
        // cout << l << " " << r <<endl;
    }
    cout << fixed << setprecision(15);
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 256