#include <bits/stdc++.h>

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

using namespace std;

class Real{
	using T=long double;
	constexpr static T EPS=1e-10;
	T x;
public:
	Real(const T& x=0):x(x){}
	Real& operator+=(const Real& r){ x+=r.x; return *this; }
	Real& operator-=(const Real& r){ x-=r.x; return *this; }
	Real& operator*=(const Real& r){ x*=r.x; return *this; }
	Real& operator/=(const Real& r){ x/=r.x; return *this; }
	Real operator+(const Real& r)const{ return Real(*this)+=r; }
	Real operator-(const Real& r)const{ return Real(*this)-=r; }
	Real operator*(const Real& r)const{ return Real(*this)*=r; }
	Real operator/(const Real& r)const{ return Real(*this)/=r; }
	Real operator-()const{ return Real(-x); }
	bool operator< (const Real& r)const{ return x<r.x-EPS; }
	bool operator> (const Real& r)const{ return r<(*this); }
	bool operator<=(const Real& r)const{ return !(r<(*this)); }
	bool operator>=(const Real& r)const{ return !((*this)<r); }
	bool operator==(const Real& r)const{ return !((*this)<r) && !(r<(*this)); }
	bool operator!=(const Real& r)const{ return (*this)<r || r<(*this); }

	friend Real operator*(const T& c,const Real& r){ return r*c; }

	friend istream& operator>>(istream& is,Real& r){ T s; is>>s; r=Real(s); return is; }
	friend ostream& operator<<(ostream& os,const Real& r){ return os<<r.x; }

	friend Real abs  (const Real& r){ return abs(r.x); }
	friend Real sqrt (const Real& r){ return sqrt(r.x); }
	friend Real cos  (const Real& r){ return cos(r.x); }
	friend Real sin  (const Real& r){ return sin(r.x); }
	friend Real atan2(const Real& y,const Real& x){ return atan2(y.x,x.x); }
};

const Real PI=acos(-1.0L);

class point{
public:
	Real x,y;
	point(){}
	point(const Real& x,const Real& y):x(x),y(y){}
	point& operator+=(const point& p){ x+=p.x; y+=p.y; return *this; }
	point& operator-=(const point& p){ x-=p.x; y-=p.y; return *this; }
	point& operator*=(const Real& c){ x*=c; y*=c; return *this; }
	point& operator/=(const Real& c){ x/=c; y/=c; return *this; }
	point operator+(const point& p)const{ return point(*this)+=p; }
	point operator-(const point& p)const{ return point(*this)-=p; }
	point operator*(const Real& c)const{ return point(*this)*=c; }
	point operator/(const Real& c)const{ return point(*this)/=c; }
	point operator-()const{ return point(-x,-y); }
	bool operator< (const point& p)const{ return tie(x,y)<tie(p.x,p.y); }
	bool operator==(const point& p)const{ return x==p.x && y==p.y; }
	bool operator!=(const point& p)const{ return !((*this)==p); }

	friend point operator*(const Real& c,const point& p){ return p*c; }
};

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

class circle{
public:
	point c;
	Real r;
	circle(){}
	circle(const point& c,const Real& r):c(c),r(r){}
};

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

	if(p1==p2 && r1==r2) return -1;

	Real d=abs(p1-p2);
	if(r1+r2<d || d<abs(r1-r2)){
		return 0;
	}
	else{
		Real a=(r1*r1-r2*r2+d*d)/(2*d);
		Real h=sqrt(max(r1*r1-a*a,Real(0)));
		point tmp1=p1+a/d*(p2-p1);
		point tmp2=h/d*(p2-p1);
		if(abs(tmp2)==0){
			res.emplace_back(tmp1);
			return 1;
		}
		else{
			res.emplace_back(tmp1.x-tmp2.y,tmp1.y+tmp2.x);
			res.emplace_back(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;
}

int main(){
	int n,k; scanf("%d%d",&n,&k);
	vector<point> P(n);
	vector<double> cost(n);
	rep(i,n) cin>>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) {
			get_intersect(circle(P[i],mi/cost[i]),circle(P[j],mi/cost[j]),C);
		}

		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: 472