#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
typedef complex<double> Point;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
#define X real()
#define Y imag()
#define LE(n,m) ((n)<(m)+EPS)
#define GE(n,m) ((n)+EPS>(m))
#define EQ(n,m) (abs((n)-(m))<EPS)
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);
struct Line{Point a,b;};
struct LineSegment{Point a,b;};
struct Circle{Point center; double r;};

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;
}

//内積
double dot(const Point &a,const Point &b){
    return (conj(a)*b).X;
}
//外積
double cross(const Point &a,const Point &b){
    return (conj(a)*b).Y;
}
//直線に正射影された点
Point proj(const Line &l,const Point &p){
    return l.a+dot(l.b-l.a,p-l.a)/norm(l.b-l.a)*(l.b-l.a);
}
//線分に正射影された点
Point proj(const LineSegment &ls,const Point &p){
    return proj(Line{ls.a,ls.b},p);
}
//直線に対して対称な位置にある点
Point refl(const Line &l,const Point &p){
    return 2.0*proj(l,p)-p;
}
//a->b->cと進む時の進行方向
int ccw(const Point &a,Point b,Point c){
    b-=a,c-=a;
    if (cross(b,c)>EPS) return 1;
    if (cross(b,c)<-EPS) return -1;
    if (dot(b,c)<-EPS) return 2;
    if (norm(b)<norm(c)) return -2;
    return 0;
}

//直線と直線の直交判定
bool is_orthogonal(const Line &l1,const Line &l2){
    return EQ(dot(l1.b-l1.a,l2.b-l2.a),0.0);
}
//直線と直線の平行判定
bool is_parallel(const Line &l1,const Line &l2){
    return EQ(cross(l1.b-l1.a,l2.b-l2.a),0.0);
}
//直線と点の一致判定
bool point_on_line(const Line &l,const Point &p){
    return EQ(cross(l.b-l.a,p-l.a),0.0);
}
//直線の交差判定
bool intersectLL(const Line &l1,const Line &l2){
    return !point_on_line(Line{l1.b-l1.a,l2.b-l2.a},0.0)
            ||point_on_line(Line{l1.a,l2.a},l2.b);
}
//直線と線分の交差判定
bool intersectLS(const Line &l,const LineSegment &ls){
    return LE(cross(l.b-l.a,ls.a-l.a)*cross(l.b-l.a,ls.b-l.a),0.0);
}
//線分と線分の交差判定
bool intersectSS(LineSegment ls1,LineSegment ls2){
    return ccw(ls1.a,ls1.b,ls2.a)*ccw(ls1.a,ls1.b,ls2.b)<=0
            &&ccw(ls2.a,ls2.b,ls1.a)*ccw(ls2.a,ls2.b,ls1.b)<=0;
}
//線分と点の一致判定
bool point_on_linesegment(const LineSegment &ls,const Point &p){
    return LE(abs(p-ls.a)+abs(ls.b-p),abs(ls.b-ls.a));
}
//直線と円の交差判定
bool intersectLC(const Line &l,const Circle &c){
    Point p=proj(l,c.center);
    return GE(c.r*c.r,norm(p-c.center));
}

//直線と点の距離
double distLP(const Line &l,const Point &p){
    return abs(proj(l,p)-p);
}
//直線と直線の距離
double distLL(const Line &l1,const Line &l2){
    return intersectLL(l1,l2)?0:distLP(l1,l2.a);
}
//直線と線分の距離
double distLS(const Line &l,const LineSegment &ls){
    return intersectLS(l,ls)?0:min(distLP(l,ls.a),distLP(l,ls.b));
}
//線分と点の距離
double distSP(const LineSegment &ls,const Point &p){
    Point pr=proj(ls,p);
    return point_on_linesegment(ls,pr)?abs(pr-p):min(abs(p-ls.a),abs(p-ls.b));
}
//線分と線分の距離
double distSS(const LineSegment &ls1,const LineSegment &ls2){
    if (intersectSS(ls1,ls2)) return 0.0;
    return min({distSP(ls1,ls2.a),distSP(ls1,ls2.b)
            ,distSP(ls2,ls1.a),distSP(ls2,ls1.b)});
}
//直線と円の中心の距離
double distLC(const Line &l,const Circle &c){
    return max(distLP(l,c.center),0.0);
}
//円と円の距離
double distCC(const Circle &c1,const Circle &c2){
    double d=abs(c1.center-c2.center);
    return GE(d,abs(c1.r-c2.r))?max(d-c1.r-c2.r,0.0)
            :abs(c1.r-c2.r)-d;
}

//直線と直線の交点
//Be careful two lines are not parallel
Point crosspointLL(const Line &l1,const Line &l2){
    Point d1=l1.b-l1.a,d2=l2.b-l2.a;
    return l1.a+d1*cross(d2,l2.a-l1.a)/cross(d2,d1);
}
//線分と線分の交点
//Be careful two line segments must intersect each other
Point crosspointSS(const LineSegment &ls1,const LineSegment &ls2){
    return crosspointLL(Line{ls1.a,ls1.b},Line{ls2.a,ls2.b});
}
//直線と線分の交点
//Be careful line and line segment must intersect each other
Point crosspointLS(const Line &l,const LineSegment &ls){
    return crosspointLL(l,Line{ls.a,ls.b});
}
//直線と円の交点
vector<Point> crosspointLC(const Line &l,const Circle &c){
    vector<Point> ps;
    Point p=proj(l,c.center);
    if (!GE(c.r*c.r,norm(p-c.center))) return ps;
    Point dir=sqrt(max(0.0,c.r*c.r-norm(p-c.center)))/abs(l.b-l.a)*(l.b-l.a);
    ps.emplace_back(p+dir);
    if (!EQ(c.r*c.r,norm(p-c.center))) ps.emplace_back(p-dir);
    return ps;
}
//円と円の交点
vector<Point> crosspointCC(const Circle &c1,const Circle &c2){
    vector<Point> ps;
    Point ls=c2.center-c1.center;
    double dist=abs(ls);
    double crL=(norm(ls)+c1.r*c1.r-c2.r*c2.r)/(2.0*dist);
    if (EQ(dist,0)||c1.r<abs(crL)) return ps;
    Point dir=ls*Point(0.0,sqrt(c1.r*c1.r-crL*crL)/dist);
    Point mc=c1.center+crL/dist*ls;
    ps.emplace_back(mc+dir);
    if (!EQ(norm(dir),0.0)) ps.emplace_back(mc-dir);
    return ps;
}

//3点を通る外接円の中心
//Be careful three points are not on the same line
Point circumcenter(Point a,Point b,const Point &c){
    a=(a-c)*0.5;
    b=(b-c)*0.5;
    return c+crosspointLL(Line{a,a*Point(1,1)},Line{b,b*Point(1,1)});
}
//3点を通る外接円の半径
double circumradius(Point a,Point b,const Point &c){
    return abs(a-circumcenter(a,b,c));
}
//2点を通る半径rの円の中心
vector<Point> centergivenradius(const Point &a,const Point &b,const double &r){
    vector<Point> cs;
    Point ls=(b-a)*0.5;
    double dist=abs(ls);
    if (dist==0.0||dist>r) return cs;
    double len=sqrt(r*r-dist*dist);
    Point n=ls*Point(0.0,1.0)*(len/dist);
    cs.emplace_back(a+ls+n);
    if (GE(len,0.0)) cs.emplace_back(a+ls-n);
    return cs;
}

//多角形における点のソート
bool cmp_x(const Point &a,const Point &b){
    return a.X!=b.X?a.X<b.X:a.Y<b.Y;
}

//凸包
vector<Point> convex_hull(vector<Point> ps){
    int n=ps.size(),k=0;
    sort(ps.begin(),ps.end(),cmp_x);
    vector<Point> ch(2*n);
    for (int i=0;i<n;ch[k++]=ps[i++]){
        while(k>=2&&ccw(ch[k-2],ch[k-1],ps[i])<=0) --k;
    }
    for (int i=n-2,t=k+1;i>=0;ch[k++]=ps[i--]){
        while(k>=t&&ccw(ch[k-2],ch[k-1],ps[i])<=0) --k;
    }
    ch.resize(k-1);
    return ch;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    int N,K; cin >> N >> K;
    vector<Point> ps;
    vector<double> cs;
    rep(i,N){
        double x,y,c; cin >> x >> y >> c;
        ps.emplace_back(x,y);
        cs.emplace_back(c);
    }
    double lb=0,ub=1e9;
    while(ub-lb>1e-7){
        double mid=(ub+lb)/2.0;
        vector<Point> cand;
        vector<Circle> checks;
        rep(i,N){
            Circle C={ps[i],mid/cs[i]};
            checks.emplace_back(C);
        }
        rep(i,N){
            cand.emplace_back(ps[i]);
            rep2(j,i+1,N){
                vector<Point> cps=crosspointCC(checks[i],checks[j]);
                for (Point p:cps) cand.emplace_back(p);
            }
        }
        int ok=0;
        for (Point p:cand){
            int cnt=0;
            rep(i,N) if (LE(abs(p-checks[i].center),checks[i].r)){
                ++cnt;
            }
            if (cnt>=K) ok=1;
        }
        (ok?ub:lb)=mid;
    }
    cout << ub << '\n';
}

Measured memory_bytes: 384