//Zory-2020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
// typedef __int128 ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define db double
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#define mem(x,val) memset(x,val,sizeof x)
#define Swap(a,b,n) for(int I=0;I<=n;I++) swap(a[I],b[I])
#define PC __builtin_popcountll
#ifdef DEBUG
	#define debug(A,args...) fprintf(stderr,A,##args)
#else
	#define debug(A,args...) printf("")
#endif
namespace mine
{
	ll qread()
	{
		ll ans=0,f=1;char c=getchar();
		while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
		while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
		return ans*f;
	}
	void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
	void write1(ll num){write(num);putchar(' ');}
	void write2(ll num){write(num);putchar('\n');}
	template<typename T>inline bool chmax(T&a,const T&b){return a<b?a=b,1:0;}
	template<typename T>inline bool chmin(T&a,const T&b){return a>b?a=b,1:0;}
	ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
	bool IN(ll x,ll l,ll r){return l<=x and x<=r;}
	void GG(){puts("No");exit(0);}
	
	const db eps=1e-8;
	const int INF=0x3f3f3f3f;
	const int MOD=1e9+7;
	int mm(const int x){return x>=MOD?x-MOD:x;}
	template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
	ll qpower(ll x,ll e,int mod=MOD){ll ans=1;while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
	ll invm(ll x){return qpower(x,MOD-2);}
	const int M=5e6+10;
	ll fac[M],facinv[M],Inv[M];ll C(int n,int m){return n<0 or n<m?0:fac[n]*facinv[m]%MOD*facinv[n-m]%MOD;}
	void PRE()
	{
		fac[0]=1;fo(i,1,M-1) fac[i]=fac[i-1]*i%MOD;
		facinv[M-1]=invm(fac[M-1]);fd(i,M-1,1) facinv[i-1]=facinv[i]*i%MOD;
		Inv[1]=1;fo(i,2,M-1) Inv[i]=(MOD-MOD/i)*Inv[MOD%i]%MOD;
	}
	const int N=1e6+10;
	//------------------FIXED------------------
	//#define db double
	//const db eps=1e-7;
	const db PI=acos(-1);
	db sqr(db x){return x*x;}
	struct V//����
	{
		db x,y;V(db _x=0,db _y=0){x=_x,y=_y;}
		V operator + (V b){return V(x+b.x,y+b.y);}
		V operator - (V b){return V(x-b.x,y-b.y);}
		V operator - (){return V(-x,-y);}
		V operator * (db b){return V(x*b,y*b);}
		db operator * (V b){return x*b.y-y*b.x;}
		db len(){return sqrt(x*x+y*y);}
		V Unit(){return V(x/len(),y/len());}
		db cross(V a,V b){return V(a.x-x,a.y-y)*V(b.x-x,b.y-y);}
		V rotate(db rad){return (V){x*cos(rad)-y*sin(rad),x*sin(rad)+y*cos(rad)};}
		bool operator == (V oth){return fabs(x-oth.x)+fabs(y-oth.y)<=eps;}
	}; typedef V pt;
	typedef pair<pt,db> cir;
	typedef pair<pt,pt> line;
	line cir_jd(cir a,cir b)//Բ�Ľ���
	{
		V oo=b.FR-a.FR;assert(oo.len()>eps);
		db x=(sqr(a.SE)-sqr(b.SE)+sqr(oo.len()))/oo.len()/2;
		pt mid=a.FR+oo*(x/oo.len());
		V go=oo.Unit().rotate(PI/2)*sqrt(sqr(a.SE)-sqr(x));return {mid-go,mid+go};
	}
	db sp(V a,V b)//�����н�
	{
		if(fabs(a.x)<=eps and fabs(a.y)<=eps) debug("err\n");
		if(fabs(b.x)<=eps and fabs(b.y)<=eps) debug("err\n");
		db c=atan2(a.y,a.x),d=atan2(b.y,b.x);
		return min(fabs(c-d),PI*2-fabs(c-d));
	}
	V chui_zu(V a,V b)//��������
	{
		db len=(b-a).len(),dis=fabs(a*b)/len;
		return (a-b).rotate(PI/2)*(dis/len)*(a*b>0?1:-1);
	}
	
	cir c[N];double cc[N];
	void main()
	{
		int n=qread(),K=qread();fo(i,1,n) c[i].FR.x=qread(),c[i].FR.y=qread(),cc[i]=qread();
		db fl=0,fr=5e5;
		while(fl+1e-7<fr)
		{
			db T=(fl+fr)/2;bool ok=0;vc<pt> S;
			fo(i,1,n) c[i].SE=T/cc[i],S.PB(c[i].FR+V(1,0)*c[i].SE);
			fo(i,1,n) fo(j,i+1,n)
			{
				db d=(c[i].FR-c[j].FR).len();if(d>c[i].SE+c[j].SE+eps or d<fabs(c[i].SE-c[j].SE)-eps) continue;
				line ret=cir_jd(c[i],c[j]);S.PB(ret.FR),S.PB(ret.SE);
			}
			for(auto in:S){ int cnt=0;fo(i,1,n) if((in-c[i].FR).len()<=c[i].SE+eps) cnt++;if(cnt>=K) ok=1; }
			if(ok) fr=T; else fl=T+eps;
		}printf("%.10lf",fl);
	}
};//����������
signed main()
{
	#ifdef DEBUG
	//freopen("a.in","r",stdin);
	freopen("z.txt","r",stdin);
	//freopen("a.out","w",stdout);
	#endif
	srand(time(0));
	mine::PRE();//����Ԥ����ģ����
	mine::main();
	debug("\n---------------------Zory---------------------\nTime: %.2lf s",1.0*clock()/CLOCKS_PER_SEC);
}

Measured memory_bytes: 142592