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

#define rep(i, n) for(int (i) = 0; (i) < (n); (i)++)
#define repn(i, n) for(int (i) = 1; (i) <= (n); (i)++)
#define repr(i, n) for(int (i) = (n-1); (i) >= 0; (i)--)
#define all(x) (x).begin(), (x).end()
#define lint long long
#define ulint unsigned long long
#define ldou long double
#define fi first
#define se second
#define setpre(x) std::cout << fixed << setprecision(x)
#define ii(x) int x; cin >> (x)
#define ii2(x, y) int x, y; cin >> (x) >> (y)
#define ii3(x, y, z) int x, y, z; cin >> (x) >> (y) >> (z)
#define out(x) cout << (x) << endl
#define outs(x) cout << (x) << " "
#define yn(x) cout << ((x)?("Yes"):("No")) << endl
#define YN(x) cout << ((x)?("YES"):("NO")) << endl
#define bit_c(x) __builtin_popcountll(x)

inline void logger(){ std::cout << " [LOGGER] " << endl; }
template<typename A, typename... B>
void logger(const A& a, const B&... b){
    cout << a << " , ";
    logger(b...);
}

typedef pair<lint, lint> P;
const lint MOD = 1000000007;
const lint MOD9 = 998244353;
const lint INF = MOD * MOD;
const int MAX = 300005;

/* ...o(^-^)o... */

ldou rad(double deg){
    return deg*M_PI/180.0;
}
ldou deg(double rad){
    return rad/M_PI*180.0;
}
struct point{
    ldou x, y;
    point(ldou x = 0.0, ldou y = 0.0) : x(x), y(y){}
    point operator-() const{
        point res(-x, -y); return res;
    }
    point& operator+=(const point& a){
        x += a.x; y += a.y; return *this;
    }
    point& operator-=(const point& a){
        x -= a.x; y -= a.y; return *this;
    }
    point& operator/=(const ldou& a){
        x /= a; y /= a; return *this;
    }
    point operator+(const point& a) const{
        return point(x, y) += a;
    }
    point operator-(const point& a) const{
        return point(x, y) -= a;
    }
    point operator/(const ldou& a){
        return point(x, y) /= a;
    }
    friend ldou operator*(const point&, const point&);
    friend point operator*(const ldou&, const point&);
    friend point operator*(const point&, const ldou&);
    point rotate(ldou angle){
        ldou t = rad(angle);
        point p(cos(t), -sin(t)), q(sin(t), cos(t)), buf(x, y);
        x = buf*p; y = buf*q;
        return *this;
    }
    point vertical(){
        return point(y, -x);
    }
};

ldou operator*(const point& p, const point& q){
    return p.x*q.x+p.y*q.y;
}
point operator*(const ldou& a, const point& p){
    return point(p.x*a, p.y*a);
}
point operator*(const point& p, const ldou& a){
    return a*p;
}

ldou norm(point p){
    return sqrt(p.x*p.x + p.y*p.y);
}
ldou dist(point s, point t){
    return norm(s-t);
}

struct circle{
    point center; ldou radius;
    circle(point p, ldou r) : center(p), radius(r) {}
    circle(ldou x = 0.0, ldou y = 0.0, ldou r = 1.0) : center(point(x, y)), radius(r) {}
};

/* @円の交点を求める */
vector<point> intersection(const circle& a, const circle& b){
    vector<point> res;
    ldou d = norm(a.center-b.center);
    if(d > a.radius+b.radius || d < abs(a.radius-b.radius)) return res;
    ldou cs = (a.radius*a.radius + d*d - b.radius*b.radius)/(2*a.radius*d);
    ldou s = a.radius*sqrt(1-cs*cs);
    point m = a.center + (b.center-a.center)*(a.radius*cs/d);
    point v = (b.center - a.center).vertical()*(s/d);
    res.push_back(m + v); res.push_back(m - v);
    return res;
}

int main(){
    int n, k; cin >> n >> k;
    vector<circle> vc;
    rep(i, n){
        ldou x, y, c; cin >> x >> y >> c;
        vc.push_back(circle(x, y, 1/c));
    }

    ldou ok = 1e6, ng = 0;
    rep(i_, 50){
        ldou t = (ok+ng)/2;
        vector<circle> wc = vc;
        rep(i, n) wc[i].radius *= t;

        vector<point> vp;
        for(int i = 0; i < n; i++) for(int j = i; j < n; j++) {
            if(i == j){
                vp.push_back(wc[i].center); continue;
            }
            auto wp = intersection(wc[i], wc[j]);
            rep(k, wp.size()) vp.push_back(wp[k]);
        }

        bool isok = false;
        rep(i, vp.size()){
            if(vp.size() < k) break;
            point p = vp[i]; int count = 0;
            rep(i, n){
                ldou ds = norm(p - wc[i].center);
                if(ds <= wc[i].radius + 1e-7) count++;
            }
            if(count >= k){
                isok = true; break;
            }
        }

        if(isok) ok = t;
        else ng = t;
    }

    setpre(10); out(ok);
}

Measured memory_bytes: 384