#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const double EPS=1e-8;
const double PI=acos(-1);

struct point{
	double x,y;
	point():x(0),y(0){}
	point(double x,double y):x(x),y(y){}
	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*=(double c){ x*=c; y*=c; return *this; }
	point& operator/=(double c){ x/=c; y/=c; return *this; }
	point operator+(const point& a)const{ return point(x+a.x,y+a.y); }
	point operator-(const point& a)const{ return point(x-a.x,y-a.y); }
	point operator/(double c)const{ return point(x/c,y/c); }
	point operator-()const{ return point(-x,-y); }
	bool operator< (const point& a)const{ return x+EPS<a.x || (abs(x-a.x)<EPS && y+EPS<a.y); }
	bool operator==(const point& a)const{ return abs(x-a.x)<EPS && abs(y-a.y)<EPS; }
	bool operator!=(const point& a)const{ return abs(x-a.x)>EPS || abs(y-a.y)>EPS; }
};

point operator*(double c,const point& a){ return point(c*a.x,c*a.y); }

double dot(const point& a,const point& b){ return a.x*b.x+a.y*b.y; }

double cross(const point& a,const point& b){ return a.x*b.y-a.y*b.x; }

double abs(const point& a){ return sqrt(a.x*a.x+a.y*a.y); }

double abs2(const point& a){ return a.x*a.x+a.y*a.y; }

point rot(const point& a,double theta){ return point(a.x*cos(theta)-a.y*sin(theta),a.x*sin(theta)+a.y*cos(theta)); }

// x 軸の正方向を基準としたときのベクトル a の角度を [0, 2*PI) の範囲で求める
double arg(const point& a){ double t=atan2(a.y,a.x); return t<0?t+2*PI:t; }

struct line{
	point a,b;
	line(){}
	line(const point& a,const point& b):a(a),b(b){}
	bool operator==(const line& L)const{ return abs(cross(b-a,L.b-L.a))<EPS && abs(cross(L.a-a,L.b-a))<EPS; }
};

struct segment{
	point a,b;
	segment(){}
	segment(const point& a,const point& b):a(a),b(b){}
	operator line()const{ return line(a,b); }
};

typedef vector<point> polygon;

struct circle{
	point c;
	double r;
	circle():c(point(0,0)),r(0){}
	circle(const point& c,double r):c(c),r(r){}
};

// 点 p を直線 L 上に射影した点を求める
point proj(const point& p,const line& L){ return L.a+dot(p-L.a,L.b-L.a)/abs2(L.b-L.a)*(L.b-L.a); }

int get_intersect(const circle &C1,const circle &C2,vector<point> &res){
	double r1=C1.r,r2=C2.r;
	point p1=C1.c,p2=C2.c;

	double d=abs(p1-p2);
	if(d<EPS && abs(r1-r2)<EPS){ // C1==C2
		return -1;
	}
	else if(r1+r2<d-EPS || d+EPS<abs(r1-r2)){
		return 0;
	}
	else{
		double a=(r1*r1-r2*r2+d*d)/(2*d);
		double h=sqrt(max(r1*r1-a*a,0.0));
		point tmp1=p1+a/d*(p2-p1);
		point tmp2=h/d*(p2-p1);
		if(abs(tmp2)<EPS){
			res.push_back(tmp1);
			return 1;
		}
		else{
			res.push_back(point(tmp1.x-tmp2.y,tmp1.y+tmp2.x));
			res.push_back(point(tmp1.x+tmp2.y,tmp1.y-tmp2.x));
			return 2;
		}
	}
}

bool cover(const circle &C,const point &p){
	return abs(C.c-p)<C.r+EPS;
}

int main(){
	int n,k; scanf("%d%d",&n,&k);
	vector<point> P(n);
	vector<double> cost(n);
	rep(i,n) scanf("%lf%lf%lf",&P[i].x,&P[i].y,&cost[i]);

	double lo=0,hi=1e9;
	rep(_,60){
		double mi=(lo+hi)/2;

		vector<point> C=P;
		rep(i,n) rep(j,i) {
			vector<point> Q;
			get_intersect(circle{P[i],mi/cost[i]},circle{P[j],mi/cost[j]},Q);
			C.insert(C.end(),Q.begin(),Q.end());
		}

		bool ok=false;
		for(point p:C){
			int cnt=0;
			rep(i,n) if(cover(circle{p,mi/cost[i]},P[i])) cnt++;
			if(cnt>=k){ ok=true; break; }
		}
		if(ok) hi=mi;
		else   lo=mi;
	}
	printf("%.9f\n",lo);

	return 0;
}


Measured memory_bytes: 384