#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

const double eps = 1e-9;
const double PI = acos(-1);
bool eq(double a,double b) { return abs(a-b) < eps; }

struct point {
    double x,y;
    inline point(double x,double y):x(x),y(y){}
    inline point operator+(const point a) const{ return {x+a.x,y+a.y}; }
    inline point operator-(const point a) const{ return {x-a.x,y-a.y}; }
    inline point operator*(const double a) const{ return {x*a,y*a}; }
    inline point operator/(const double a) const{ return {x/a,y/a}; }
    inline point operator-() const{ return *this*(-1); }
    inline bool operator==(const point a) const{ return eq(x,a.x) && eq(y,a.y); }
    inline bool operator!=(const point a) const{ return !(*this == a); }
    inline double abs() { return sqrt(x*x+y*y); }
    inline point rot90() { return point(-y,x); }
    inline double arg() { return atan2(y,x);}
};
inline double dist(point a,point b) { return (a-b).abs(); }
inline double dot(point a,point b) { return a.x*b.x+a.y*b.y; }
inline double cross(point a,point b) { return a.x*b.y-a.y*b.x; }
inline point mid(point a,point b) { return (a+b)/2; }
struct line {
    point a,b;
    inline line(point a,point b):a(a),b(b) {}
    inline bool online(point p) { return eq(cross(b-a,p-a),0.0); }
    inline double dist(point p) { return abs(cross(b-a,p-a))/(b-a).abs(); }
    inline line vertical_bisector() {
        return line(mid(a,b),mid(a,b)+(b-a).rot90());
    }
};
inline bool vertical(line l,line m) { return eq(dot(l.a-l.b,m.a-m.b),0.0); }
inline bool parallel(line l,line m) { return eq(cross(l.a-l.b,m.a-m.b),0.0); }
inline bool intersect(line l,line m) { //for seg_line
    return (cross(l.b-l.a,m.a-l.a)*cross(l.b-l.a,m.b-l.a) < eps) &&
            (cross(m.b-m.a,l.a-m.a)*cross(m.b-m.a,l.b-m.a) < eps);
}
inline point intersection(line l,line m) {
    assert(!parallel(l,m));
    return l.a+(l.b-l.a)*cross(m.b-m.a,m.a-l.a)/cross(m.b-m.a,l.b-l.a);
}
inline point gaisin(point a,point b,point c) {
    return intersection(line(a,b).vertical_bisector(),line(b,c).vertical_bisector());
}
struct circle {
    point o;
    double r;
    inline circle(point o,double r):o(o),r(r) {}
};
inline vector<point> intersection(circle a,circle b) {
    double d = dist(a.o,b.o);
    if(eq(a.r+b.r,d)) return {a.o+(b.o-a.o)*a.r/d};
    if(eq(a.r-b.r,d)) return {a.o+(b.o-a.o)*a.r/d};
    if(eq(b.r-a.r,d)) return {b.o+(a.o-b.o)*b.r/d};
    if(abs(a.r-b.r)+eps > d || d+eps > a.r+b.r) return {};
    double x = (pow(a.r,2.0)+pow(d,2.0)-pow(b.r,2.0))/(2*d);
    double y = sqrt(pow(a.r,2.0)-pow(x,2.0));
    point p = (b.o-a.o).rot90()*y/d;
    point tomid = a.o+(b.o-a.o)*x/d;
    return {tomid+p,tomid-p};
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin >> n >> k;
    vector<pair<point,double>> niku;
    rep(i,n) {
        int x,y,c;
        cin >> x >> y >> c;
        niku.emplace_back(point(x,y),c);
    }
    double l = 0,r = 1001001001;
    rep(_,100) {
        double mid = (l+r)/2;
        vector<circle> v;
        rep(i,n) {
            v.emplace_back(niku[i].first,mid/niku[i].second);
        }
        vector<point> can;
        rep(i,n) can.pb(v[i].o);
        rep(i,n) rep(j,n) {
            if(i >= j) continue;
            vector<point> nv = intersection(v[i],v[j]);
            for(auto p : nv) can.pb(p);
        }
        int num = 0;
        for(auto p : can) {
            int now = 0;
            for(auto q : v) {
                if(dist(p,q.o) < q.r+eps) now++;
            }
            chmax(num,now);
        }
        if(num < k) l = mid;
        else r = mid;
    }
    printf("%.10f",r);
}


Measured memory_bytes: 512