#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define ALL(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define de(x) cout << #x << "=" << x << endl;
#define SP << " " <<
template <class T> bool maxi(T &a, const T &b) {
    if (a < b) { a = b; return 1;} return 0;}
template <class T> bool mini(T &a, const T &b) {
    if (b < a) { a = b; return 1;} return 0;}
#define dame {cout<< "-1" <<"\n"; return;}
#define INF2 1000000000000000037
#define INF  1000000007
#define MOD  1000000007
using namespace std;
using ll = long long;
using ld = long double;
using P  = pair<ll,ll>;
//--GLOBAL---------------------------------
const ld INFL=1LL<<60;
const ld EPS=1e-9;
const ld PI=acosl(-1.0);
ld todeg(ld rad) {return rad*180/PI;}
ld torad(ll deg) {return (ld)(deg)*PI/180;}

struct Point {
    ld x,y;
    Point(ld x = 0.0, ld y = 0.0) : x(x), y(y) {}
    friend ostream& operator << (ostream &s, const Point &p) {return s << '(' << p.x << ", " << p.y << ')';}
};
inline Point operator + (const Point &p, const Point &q) {return Point(p.x + q.x, p.y + q.y);}
inline Point operator - (const Point &p, const Point &q) {return Point(p.x - q.x, p.y - q.y);}
inline Point operator * (const Point &p, ld a) {return Point(p.x * a, p.y * a);}
inline Point operator * (ld a, const Point &p) {return Point(a * p.x, a * p.y);}
inline Point operator * (const Point &p, const Point &q) {return Point(p.x * q.x - p.y * q.y, p.x * q.y + p.y * q.x);}
inline Point operator / (const Point &p, ld a) {return Point(p.x / a, p.y / a);}
inline Point conj(const Point &p) {return Point(p.x, -p.y);} //共役
inline Point rot(const Point &p, ld ang) {return Point(cos(ang) * p.x - sin(ang) * p.y, sin(ang) * p.x + cos(ang) * p.y);}
inline Point rot90(const Point &p) {return Point(-p.y, p.x);}
inline Point midl(const Point &p, const Point &q) {return Point((p.x+q.x)/2, (p.y+q.y)/2);}
inline ld cross(const Point &p, const Point &q) {return p.x * q.y - p.y * q.x;} // cross product クロス積（ベクトル積、外積）の大きさ
inline ld dot(const Point &p, const Point &q) {return p.x * q.x + p.y * q.y;} //内積（スカラー積）
inline ld norm(const Point &p) {return dot(p, p);}
inline ld abs(const Point &p) {return sqrt(dot(p, p));}
inline ld ang(const Point &p) {ld res = atan2(p.y, p.x); if (res < 0) res += PI*2; return res;} //角度 rad
inline ld area(const Point &a, const Point &b, const Point &c) { return abs(cross(b - a, c - a)) / 2; } //面積
inline bool eq(const Point &p, const Point &q) {return abs(p - q) < EPS;}
inline bool operator < (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x < q.x : p.y < q.y);} // x->y の順
inline bool operator > (const Point &p, const Point &q) {return (abs(p.x - q.x) > EPS ? p.x > q.x : p.y > q.y);}

struct Line : vector<Point> {
    Line(Point a = Point(0.0, 0.0), Point b = Point(0.0, 0.0)) {
        this->emplace_back(a);
        this->emplace_back(b);
    }
    friend ostream& operator << (ostream &s, const Line &l) {return s << '{' << l[0] << ", " << l[1] << '}';}
};

// 1：a->b向きでcが左(反時計)、-1：cはが右(時計)、0：一直線上
int pointside(const Point &a, const Point &b, const Point &c) {
    if (cross(b-a, c-a) > EPS) return 1;
    if (cross(b-a, c-a) < -EPS) return -1;
    /*
    if(dot(b-a, c-a) < 0) return 2; // c-a-b
    if(norm(b-a) < norm(c-a)) return -2; // a-b-c else a-c-b
    */
    return 0;
}

// 垂線の足
Point proj(const Point &p, const Line &l) {
    ld t = dot(p - l[0], l[1] - l[0]) / norm(l[1] - l[0]);
    return l[0] + (l[1] - l[0]) * t;
}

// 対称点
Point refl(const Point &p, const Line &l) {
    return p + (proj(p, l) - p) * 2;
}

// Lineの交点
vector<Point> crosspoint(const Line &l, const Line &m) {
    vector<Point> res;
    ld d = cross(m[1] - m[0], l[1] - l[0]);
    if (abs(d) < EPS) return vector<Point>();
    res.push_back(l[0] + (l[1] - l[0]) * cross(m[1] - m[0], m[1] - l[0]) / d);
    return res;
}

// 3点から等距離の点  if(pointside(a,b,c)==0) skip;
Point centerpoint(const Point &a, const Point &b, const Point &c) {
    Line ab((a+b)/2, (a+b)/2 + rot90(a-b));
    Line bc((b+c)/2, (b+c)/2 + rot90(b-c));
    return crosspoint(ab, bc)[0];
}

// 凸包
vector<pair<Point, int> > ConvexHull(vector<pair<Point, int>> &ps) {
    int n = ps.size();
    vector<pair<Point, int> > res(2*n);
    SORT(ps);
    int k = 0;
    for (int i = 0; i < n; ++i) { // 下凸包を左下から右に調べる
        if (k >= 2) {
            while (cross(res[k-1].first - res[k-2].first, ps[i].first - res[k-2].first) < EPS) { //中間が上なら中間を取り除く
                --k;
                if (k < 2) break;
            }
        }
        res[k].first = ps[i].first; res[k].second = ps[i].second;
        ++k;
    }
    int t = k+1; // 下凸包は決定、次の1個は入れる
    for (int i = n-2; i >= 0; --i) { // 上凸包を右上から左に調べる
        if (k >= t) {
            while (cross(res[k-1].first - res[k-2].first, ps[i].first - res[k-2].first) < EPS) {
                --k;
                if (k < t) break;
            }
        }
        res[k].first = ps[i].first; res[k].second = ps[i].second;
        ++k;
    }
    res.resize(k-1); //最後は最初と同じなので除く
    return res;
}

struct Circle : Point {
    ld r;
    Circle(Point p = Point(0.0, 0.0), ld r = 0.0) : Point(p), r(r) {}
    friend ostream& operator << (ostream &s, const Circle &c) {return s << '(' << c.x << ", " << c.y << ", " << c.r << ')';}
};

// 点と円の接線の傾き
vector<Point> tanline(const Point &p, const Circle &c) {
    vector<Point> res;
    ld d = norm(p - c);
    ld l = d - c.r * c.r;
    if (l < -EPS) return res;
    if (l <= 0.0) l = 0.0;
    Point cq = (p - c) * (c.r * c.r / d);
    Point qs = rot90((p - c) * (c.r * sqrt(l) / d));
    Point s1 = c + cq + qs, s2 = c + cq - qs;
    res.push_back(s1);
    res.push_back(s2);
    return res;
}

// 円と円の共通接線
vector<Line> comtanline(Circle a, Circle b) {
    vector<Line> res;
    if (abs(a - b) > abs(a.r - b.r) + EPS) {
        if (abs(a.r - b.r) < EPS) {
            Point dir = b - a;
            dir = rot90(dir * (a.r / abs(dir)));
            res.push_back(Line(a + dir, b + dir));
            res.push_back(Line(a - dir, b - dir));
        }
        else {
            Point p = a * -b.r + b * a.r;
            p = p * (1.0 / (a.r - b.r));
            vector<Point> bs = tanline(p, a);
            vector<Point> as = tanline(p, b);
            for (int i = 0; i < min(as.size(), bs.size()); ++i) {
                res.push_back(Line(bs[i], as[i]));
            }
        }
    }
    if (abs(a - b) > a.r + b.r + EPS) {
        Point p = a * b.r + b * a.r;
        p = p * (1.0 / (a.r + b.r));
        vector<Point> bs = tanline(p, a);
        vector<Point> as = tanline(p, b);
        for (int i = 0; i < min(as.size(), bs.size()); ++i) {
            res.push_back(Line(bs[i], as[i]));
        }
    }
    return res;
}

// 円と円の交点
vector<Point> crosspoint(const Circle &e, const Circle &f) {
    vector<Point> res;
    ld d = abs(e - f);
    if (d < EPS) return vector<Point>();
    if (d > e.r + f.r + EPS) return vector<Point>();
    if (d < abs(e.r - f.r) - EPS) return vector<Point>();
    ld rcos = (d * d + e.r * e.r - f.r * f.r) / (2.0 * d), rsin;
    if (e.r - abs(rcos) < EPS) rsin = 0;
    else rsin = sqrt(e.r * e.r - rcos * rcos);
    Point dir = (f - e) / d;
    Point p1 = e + dir * Point(rcos, rsin);
    Point p2 = e + dir * Point(rcos, -rsin);
    res.push_back(p1);
    if (!eq(p1, p2)) res.push_back(p2);
    return res;
}

// 円と直線の交点
vector<Point> crosspoint(const Circle &e, const Line &l) {
    vector<Point> res;
    Point p = proj(e, l);
    ld rcos = abs(e - p), rsin;
    if (rcos > e.r + EPS) return vector<Point>();
    else if (e.r - rcos < EPS) rsin = 0;
    else rsin = sqrt(e.r * e.r - rcos * rcos);
    Point dir = (l[1] - l[0]) / abs(l[1] - l[0]);
    Point p1 = p + dir * rsin;
    Point p2 = p - dir * rsin;
    res.push_back(p1);
    if (!eq(p1, p2)) res.push_back(p2);
    return res;
}

// 円と線分の交点
int ccw_for_crosspoint_cs(const Point &a, const Point &b, const Point &c) {
    if (cross(b-a, c-a) > EPS) return 1;
    if (cross(b-a, c-a) < -EPS) return -1;
    if (dot(b-a, c-a) < -EPS) return 2;
    if (norm(b-a) < norm(c-a) - EPS) return -2;
    return 0;
}
bool isinterPS_crosspoint_cs(const Point &p, const Line &s) {
    return (ccw_for_crosspoint_cs(s[0], s[1], p) == 0);
}
vector<Point> crosspoint_CS(const Circle &e, const Line &s) {
    vector<Point> res;
    Point p = proj(e, s);
    ld rcos = abs(e - p), rsin;
    if (rcos > e.r + EPS) return vector<Point>();
    else if (e.r - rcos < EPS) rsin = 0;
    else rsin = sqrt(e.r * e.r - rcos * rcos);
    Point dir = (s[1] - s[0]) / abs(s[1] - s[0]);
    Point p1 = p + dir * rsin;
    Point p2 = p - dir * rsin;
    if (isinterPS_crosspoint_cs(p1, s)) res.push_back(p1);
    if (isinterPS_crosspoint_cs(p2, s) && !eq(p1, p2)) res.push_back(p2);
    return res;
}


//--MAIN-----------------------------------
void Main() {
    ll N,K; cin>>N>>K;

    vector<Point> poi(N);
    vector<ld> c(N);
    rep(i,N){
        cin>>poi[i].x>>poi[i].y>>c[i];
    }

    /*bis*/ ld low= 0 , high= INF2 ; // min-1, max+1
    rep(kai,300){ ld mid=(high+low)/2;
        bool ok=false;
        rep(i,N){
            rep(j,N){
                Circle a(poi[i],mid/c[i]);
                Circle b(poi[j],mid/c[j]);
                auto netsu=crosspoint(a,b);
                netsu.emplace_back(poi[j]);
                for(auto pos: netsu){
                    ll ct=0;
                    rep(k,N){
                        if(abs(pos-poi[k])*c[k]<=mid+EPS) ++ct;
                    }
                    if(ct>=K) ok=true;
                }

            }
        }

        ( ok ? high : low ) = mid;
    }// okdir : ngdir
    cout<< high <<"\n";
}

//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}
//-----------------------------------------


Measured memory_bytes: 256