#include<bits/stdc++.h>
#define LL long long
using namespace std;
#define inf 0x3fffffff

typedef long double LD;
int n,k;
struct data
{
    LD x,y,c;
}a[100];
#define y1 yy1
#define nxt(i) ((i + 1) % s.size())
const LD PI = 3.14159265358979323846;
const LD eps = 1E-10;
int sgn(LD x) { return fabs(x) < eps ? 0 : (x > 0 ? 1 : -1); }
struct L;
struct P;
typedef P V;
struct P {
    LD x, y;
    explicit P(LD x = 0, LD y = 0): x(x), y(y) {}
    explicit P(const L& l);
};
struct L {
    P s, t;
    L() {}
    L(P s, P t): s(s), t(t) {}
};

P operator + (const P& a, const P& b) { return P(a.x + b.x, a.y + b.y); }
P operator - (const P& a, const P& b) { return P(a.x - b.x, a.y - b.y); }
P operator * (const P& a, LD k) { return P(a.x * k, a.y * k); }
P operator / (const P& a, LD k) { return P(a.x / k, a.y / k); }
inline bool operator < (const P& a, const P& b) {
    return sgn(a.x - b.x) < 0 || (sgn(a.x - b.x) == 0 && sgn(a.y - b.y) < 0);
}
bool operator == (const P& a, const P& b) { return !sgn(a.x - b.x) && !sgn(a.y - b.y); }
P::P(const L& l) { *this = l.t - l.s; }
ostream &operator << (ostream &os, const P &p) {
    return (os << "(" << p.x << "," << p.y << ")");
}
istream &operator >> (istream &is, P &p) {
    return (is >> p.x >> p.y);
}

LD dist(const P& p) { return sqrt(p.x * p.x + p.y * p.y); }
LD dot(const V& a, const V& b) { return a.x * b.x + a.y * b.y; }
LD det(const V& a, const V& b) { return a.x * b.y - a.y * b.x; }
LD cross(const P& s, const P& t, const P& o = P()) { return det(s - o, t - o); }
// 是否平行
bool parallel(const L& a, const L& b) {
    return !sgn(det(P(a), P(b)));
}
// 直线是否相等
bool l_eq(const L& a, const L& b) {
    return parallel(a, b) && parallel(L(a.s, b.t), L(b.s, a.t));
}
// 逆时针旋转 r 弧度
P rotation(const P& p, const LD& r) { return P(p.x * cos(r) - p.y * sin(r), p.x * sin(r) + p.y * cos(r)); }
P RotateCCW90(const P& p) { return P(-p.y, p.x); }
P RotateCW90(const P& p) { return P(p.y, -p.x); }
// 单位法向量
V normal(const V& v) { return V(-v.y, v.x) / dist(v); }
struct C {
    P p; LD r;
    C(LD x = 0, LD y = 0, LD r = 0): p(x, y), r(r) {}
    C(P p, LD r): p(p), r(r) {}
}b[110];
vector<P> c_c_intersection(C a, C b) {
    vector<P> ret;
    LD d = dist(a.p - b.p);
    if (sgn(d) == 0 || sgn(d - (a.r + b.r)) > 0 || sgn(d + min(a.r, b.r) - max(a.r, b.r)) < 0)
        return ret;
    LD x = (d * d - b.r * b.r + a.r * a.r) / (2 * d);
    LD y = sqrt(a.r * a.r - x * x);
    P v = (b.p - a.p) / d;
    ret.push_back(a.p + v * x + RotateCCW90(v) * y);
    if (sgn(y) > 0) ret.push_back(a.p + v * x - RotateCCW90(v) * y);
    return ret;
}

int calc(P x)
{
    int ans=0;
    for (int i=1;i<=n;i++)
        if (dist(b[i].p-x)-b[i].r<eps) ans++;
    return ans;
}

int c_c_relation(const C& a, const C& v) {
    LD d = dist(a.p - v.p);
    if (sgn(d - a.r - v.r) > 0) return 5;
    if (sgn(d - a.r - v.r) == 0) return 4;
    LD l = fabs(a.r - v.r);
    if (sgn(d - l) > 0) return 3;
    if (sgn(d - l) == 0) return 2;
    if (sgn(d - l) < 0) return 1;
}

int calc2(C x)
{
    int ans=0;
    for (int i=1;i<=n;i++)
        if (c_c_relation(x,b[i])<=2&&x.r-b[i].r<eps) ans++;
    return ans;
}

bool check(LD x)
{
    for (int i=1;i<=n;i++)
        b[i].p.x=a[i].x,b[i].p.y=a[i].y,b[i].r=x/a[i].c;
    int ans=1;
    for (int i=1;i<=n;i++)
        for (int j=i+1;j<=n;j++)
        {
            vector<P> res=c_c_intersection(b[i],b[j]);
            for (auto x:res)
                ans=max(ans,calc(x));
        }
    for (int i=1;i<=n;i++)
        ans=max(ans,calc2(b[i]));
    return ans>=k;
}

int main()
{
    cin>>n>>k;
    for (int i=1;i<=n;i++)
        cin>>a[i].x>>a[i].y>>a[i].c;
    if (k==1) {puts("0");return 0;}
    int T=500;LD l=0.0,r=300000.0,mid;
    while(T--)
    {
        mid=(l+r)*0.5;
        if (check(mid)) r=mid;else l=mid;
    }
    printf("%0.8f\n",(double)r);
    return 0;
}

Measured memory_bytes: 384