#include <bits/stdc++.h>
using namespace std;

// {{{
constexpr double eps = 1e-9;
struct Point {
    double x, y;
    Point(double x=0, double y=0) : x(x), y(y) {}
    static double f(double a, double b) { // 浮點數誤差
        return ( abs(a+b)<eps*(abs(a)+abs(b)) )? 0 : a+b;
    }
    Point operator+(const Point& p) const { return Point(f(x, p.x), f(y, p.y)); }
    Point operator-(const Point& p) const { return Point(f(x, -p.x), f(y, -p.y)); }
    Point operator*(double a) const { return Point(x*a, y*a); } // 向量伸縮
    Point operator/(double a) const { return Point(x/a, y/a); } // 向量伸縮
    Point inv() const { return conj()/norm2(); }

    bool operator<(const Point &p) const { return x!=p.x ? x<p.x : y<p.y; }
    bool operator==(const Point &p) const { return f(x, -p.x)==0 && f(y, -p.y)==0; }

    double dot(Point p) const { return f(x * p.x, y * p.y); }
    double det(Point p) const { return f(x * p.y, -y * p.x); }
    double norm2() const { return x*x+y*y; }
    double norm() const { return sqrt(norm2()); }
    double arg() const { return atan2(y,x); }

    // rotate by rad
    Point rotate(double rad) {
        return Point(f(x*cos(rad), -y*sin(rad)), f(x*sin(rad), y*cos(rad)));
    }
    Point rot90() const { return Point(-y, x); }
    Point rot270() const { return Point(y, -x); }
    Point conj() const { return Point(x,-y); }

    friend istream &operator>>(istream &is, Point &p) { double x, y; is >> x >> y; p = Point(x, y); return is; }
    friend ostream &operator<<(ostream &os, const Point &p) { os << '(' << p.x << ',' << p.y << ')'; return os; }
};
// }}}

// 計算交點
vector<Point> compute(Point a, Point b, double ra, double rb) {
    Point v=b-a;
    double d=v.norm();
    if ( d==0 ) return {}; // 共圓心
    if ( d+ra+rb==max({d,ra,rb})*2 ) return { a+v*(ra/d) }; // 內切 外切
    if ( d+ra+rb<max({d,ra,rb})*2 ) return {};  // 包含
    double rx=( d*d + ra*ra - rb*rb )/(2*d);
    double rh=sqrt( ra*ra - rx*rx ); 
    Point x=a + v*(rx/d); // 交點連線跟圓心連線的點
    Point y=v.rot90()*(rh/d);
    return { x+y, x-y };
}

int main() {
    int N, K;
    cin >> N >> K;
    vector<double> X(N), Y(N), C(N);
    for ( int i=0; i<N; i++ ) {
        cin >> X[i] >> Y[i] >> C[i];
    }
    vector<Point> Center(N);
    for ( int i=0; i<N; i++ ) {
        Center[i]=Point(X[i],Y[i]);
    }
    double lb=0, ub=1e9; // 二分搜尋所需時間
    for ( int q=0; q<100; q++ ) {
        double t=(lb+ub)/2;
        vector<double> R(N);
        for ( int i=0; i<N; i++ ) {
            R[i]=t/C[i];
        }
        vector<Point> ps;
        for ( int i=0; i<N; i++ ) ps.push_back(Center[i]);
        for ( int i=0; i<N; i++ ) {
            for ( int j=0; j<i; j++ ) {
                auto vp=compute(Center[i], Center[j], R[i], R[j]);
                ps.insert(ps.end(), vp.begin(), vp.end());
            }
        }
        bool ok=false;
        for ( Point p:ps ) {
            int cnt=0;
            for ( int k=0; k<N; k++ ) {
                if ( (Center[k]-p).norm()<=R[k]+eps ) {
                    cnt++;
                }
            }
            if ( cnt>=K ) {
                ok=true;
                break;
            }
        }
        if ( ok ) {
            ub=t;
        }
        else {
            lb = t;
        }
    }
    cout << fixed << setprecision(10) << ub << endl;
    return 0;
}

Measured memory_bytes: 256