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

#define dforsn(i,s,n) for(int i=int(n-1);i>=int(s);i--)
#define forsn(i,s,n) for(int i=int(s);i<int(n);i++)
#define dforn(i,n) for(int i=int(n-1);i>=0;i--)
#define forn(i,n) for(int i=0;i<int(n);i++)
#define D(a) cerr << #a << " = " << a << endl
#define all(a) a.begin(),a.end()
#define si(a) int((a).size())
typedef pair<int,int> pii;
typedef long long int ll;
typedef vector<int> vi;
#define pb emplace_back
#define mp make_pair
#define snd second
#define fst first

const double EPS = 1e-9;

struct pto {
	double x, y;
	pto(double _x=0, double _y=0) : x(_x),y(_y) {}
	pto operator+(pto a) { return pto(x + a.x, y + a.y); }
	pto operator-(pto a) { return pto(x - a.x, y - a.y); }
	pto operator*(double a) { return pto(x*a, y*a); }
	pto operator/(double a) { return pto(x/a, y/a); }
	double norm() { return sqrt(x*x + y*y); }
};
double dist(pto a, pto b) { return (b-a).norm(); }
pto CCW90(pto p) { return pto(-p.y, p.x); }

struct circle { pto p; double r; };

vector<pto> interCC(circle &a, circle &b) {
    vector<pto> r;
    double d = dist(a.p, b.p);
    if (d > a.r + b.r + EPS || d + min(a.r, b.r) < max(a.r, b.r) - EPS) return r;
    double x = (d*d + a.r*a.r - b.r*b.r) / (2*d);
    double y = sqrt(a.r*a.r - x*x);
    pto v = (b.p - a.p) / d;
    r.pb(a.p + v*x + CCW90(v)*y);
    if (y > EPS) r.pb(a.p + v*x - CCW90(v)*y);
    return r;
}
bool inside(circle &c, pto &p) {
    return dist(c.p, p) < c.r + EPS;
}

int main() {
    ios_base::sync_with_stdio(0), cin.tie(0);
    
    int n,k; cin >> n >> k;
    vector<pto> a(n); 
    int b[n];
    forn(i, n) cin >> a[i].x >> a[i].y >> b[i];

    auto f = [&](double t) { // O(n^3)
        vector<circle> cir(n);
        forn(i, n) cir[i] = {a[i], t/b[i]};

        vector<pto> can(all(a));
        forn(i, n) forsn(j, i+1, n)
            for (pto &p : interCC(cir[i], cir[j])) 
                can.pb(p);

        int m = 0;
        for (auto &p : can) {
            int q = 0;
            for (auto &c : cir)
                if (inside(c, p)) q++;
            m = max(m, q);
        }
        return m < k;
    };

    double l = 0, h = 3e5;
    while (h-l > EPS) {
        double m = (l+h)/2;
        if (f(m)) l = m;
        else h = m;
    }
    cout << fixed << setprecision(6) << l << endl;
    return 0;
}
