#include <bits/stdc++.h>
using namespace std;
#define mod 998244353
#define MOD 1000000007
#define inf 0x3f3f3f3f
#define linf 0x3f3f3f3f3f3f3f3fll
#define eps 1e-6
#define pi acos(-1)
typedef long long ll;
typedef pair<int,int> pii;
typedef unsigned long long ull;
int n,K;
int X[66],Y[66],C[66];
inline bool less2(double A,double B)
{
	double dif=(B-A);
	if(fabs(dif)<eps)return 0;
	return dif>0;
}
struct Point
{
	double x,y;
	Point(){}
	Point(double x,double y):x(x),y(y){}
};
struct Circle
{
	Point center;
	double r;
	Circle(){}
	Circle(Point center,double r):center(center),r(r){}
};
struct Arc
{
	Circle c;
	Point a,b;
	double ang;
	Arc(){}
	Arc(Point a,Point b,Circle c,double ang):a(a),b(b),c(c),ang(ang){};
};
inline double dist(Point &a,Point &b)
{
//	cout<<"DD "<<a.x<<' '<<a.y<<" "<<b.x<<" "<<b.y<<endl;
//	cout<<((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y))<<endl;
	return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
vector<Point> getinter(Circle &a,Circle &b)
{
	vector<Point> res;
	res.clear();
	
	double xa=a.center.x-b.center.x;
	double ya=a.center.y-b.center.y;
	double S=xa*xa+ya*ya;
	double aa=(S+b.r*b.r-a.r*a.r)/2.0;
	double D=S*b.r*b.r-aa*aa;
	if(D+eps<0)return res;
	D=sqrt(D);
	double A1=aa*xa,A2=aa*ya;
	double B1=D*ya,B2=D*xa;
//	cout<<A1<<" "<<B1<<" "<<A2<<" "<<B2<<" "<<xa<<" "<<ya<<" "<<S<<" "<<D*D<<" "<<D<<" "<<aa<<" "<<a.r<<' '<<b.r<<endl;
	res.push_back(Point(b.center.x+(A1+B1)/S,b.center.y+(A2-B2)/S));
	res.push_back(Point(b.center.x+(A1-B1)/S,b.center.y+(A2+B2)/S));
	
	return res;
}
const Arc big=Arc(Point(200000.0,0.0),Point(200000.0,0.0),Circle(Point(0.0,0.0),200000.0),2*pi);
vector<Circle> cur;
double has[66];
inline bool less3(Circle &a,Circle &b)
{
	return less2(a.r,b.r);
}
vector<Point> tmp;
inline void solve()
{
//	sort(cur.begin(),cur.end(),less3);
	tmp.clear();
	for(int i=0;i<n;i++)
	{
		tmp.push_back(cur[i].center);
		for(int j=0;j<n;j++)
		{
			if(i==j)continue;
			vector<Point> pts=getinter(cur[i],cur[j]);
			for(int k=0;k<pts.size();k++)
			{
				tmp.push_back(pts[k]);
				
			//	cout<<i<<" "<<j<<endl;
			//	cout<<cur[i].r<<" "<<cur[j].r<<endl;
			//	cout<<pts[k].x<<" "<<pts[k].y<<endl;
			//	system("pause");
			}
		}
		
	}
}
inline bool inside(Point x,Circle c)
{
	double d=dist(x,c.center);
//	cout<<d<<" "<<(c.r*c.r+eps)<<endl;
	return d<(c.r*c.r+eps);
}
inline bool check(double T)
{
//	cout<<"check "<<T<<endl;
	for(int i=0;i<=n;i++)has[i]=0.0;
	cur.clear();
	for(int i=0;i<n;i++)
	{
	//	cout<<i<<" "<<T<<endl;
		cur.push_back(Circle(Point(1.0*X[i],1.0*Y[i]),T/(1.0*C[i])));
	}
	solve();
	for(int i=0;i<tmp.size();i++)
	{
		int cnt=0;
		for(int j=0;j<n;j++)
		{
			if(inside(tmp[i],cur[j]))cnt++;
			else
			{
		//		cout<<"out "<<i<<" "<<cur[j].center.x<<" "<<cur[j].center.y<<" "<<cur[j].r<<endl;
			}
		}
	//	cout<<tmp[i].x<<" "<<tmp[i].y<<" "<<cnt<<endl;system("pause");
		if(cnt>=K)return 1;
	}
	return 0;
}
int main()
{
	scanf("%d%d",&n,&K);
	for(int i=0;i<n;i++)
	{
		scanf("%d%d%d",&X[i],&Y[i],&C[i]);
	}
	if(K==1)
	{
		printf("0\n");
		return 0;
	}
	double L=0.0,R=200000.0;//(L,R]
	while(less2(L,R))
	{
		double MID=(L+R)/2.0;
		if(check(MID))R=MID;
		else L=MID;
	}
	check(2.4);
	printf("%.10lf\n",R);
	return 0;
}

Measured memory_bytes: 384