#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);
const long double EPS = 1e-10L;

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int n,m;
long double x[66],y[66],c[66],r[66];

long double dist(long double x1, long double y1, long double x2, long double y2){
	return sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
}

bool judge(long double t){
	int i,j,k,cnt=0;
	long double xc,yc,a,p,q;
	for(i=0; i<n; ++i){
		r[i] = t/c[i];
	}
	for(i=0; i<n; ++i){
		cnt = 0;
		for(k=0; k<n; ++k){
			if(r[k]>=dist(x[k],y[k],x[i],y[i])+EPS){
				++cnt;
			}
		}
		if(cnt>=m){
			return true;
		}
		for(j=0; j<i; ++j){
			p = x[j]-x[i]; q = y[j]-y[i];
			a = p*p+q*q-r[j]*r[j]+r[i]*r[i]; a/=2.0L;
			if(dist(x[i],y[i],x[j],y[j])>r[i]+r[j]+EPS){
				continue;
			}
			if(dist(x[i],y[i],x[j],y[j])+EPS<abs(r[i]-r[j])){
				continue;
			}
			cnt = 0;
			xc = a*p+q*sqrt((p*p+q*q)*r[i]*r[i]-a*a); xc /= (p*p+q*q); xc += x[i];
			yc = a*q-p*sqrt((p*p+q*q)*r[i]*r[i]-a*a); yc /= (p*p+q*q); yc += y[i];
			for(k=0; k<n; ++k){
				if(r[k]+EPS>=dist(x[k],y[k],xc,yc)){
					++cnt;
				}
			}
			if(cnt>=m){
				return true;
			}
			cnt = 0;
			xc = a*p-q*sqrt((p*p+q*q)*r[i]*r[i]-a*a); xc /= (p*p+q*q); xc += x[i];
			yc = a*q+p*sqrt((p*p+q*q)*r[i]*r[i]-a*a); yc /= (p*p+q*q); yc += y[i];
			for(k=0; k<n; ++k){
				if(r[k]+EPS>=dist(x[k],y[k],xc,yc)){
					++cnt;
				}
			}
			if(cnt>=m){
				return true;
			}
		}
	}
	return false;
}

int main(void){
	int i;
	long double ok=4e6L,ng=0.0L,med;
	cin >> n >> m;
	for(i=0; i<n; ++i){
		cin >> x[i] >> y[i] >> c[i];
	}
	for(i=0; i<100; ++i){
		med = (ok+ng)/2.0L;
		if(judge(med)){
			ok = med;
		}else{
			ng = med;
		}
	}
	cout << fixed << setprecision(20) << ok << endl; 
	return 0;
}
