#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 10000000000000

const double eps = 1e-10;

template <typename T>
struct vector_2d{
	T x,y,r,d;
	
	vector_2d(T a=0.0,T b=0.0){
		x = a;
		y = b;
		fix_rd();
	}
	
	void update_x(T a,T b){
		x = a*x + b;
		fix_rd();
	}
	
	void update_x(T a){
		update_x(0.0,a);
	}
	
	void update_y(T a,T b){
		y = a*y + b;
		fix_rd();
	}
	
	void update_y(T a){
		update_y(0.0,a);
	}
	
	void update_r(T a,T b){
		r = a*r + b;
		fix_xy();
	}
	
	void update_r(T a){
		update_r(0.0,a);
	}
	
	void update_d(T a,T b){
		d = a*d + b;
		fix_xy();
	}

	void update_d(T a){
		update_d(0.0,a);
	}
	
	void fix_xy(){
		x = r * cos(d);
		y = r * sin(d);
		fix_rd();
	}
	
	void fix_rd(){
		r = hypot(x,y);
		if(r==0.0)d=0.0;
		else d = atan2(y,x);
		fix_zero();
	}
	
	void fix_zero(){
		if(abs(x)<eps)x = 0.0;
		if(abs(y)<eps)y = 0.0;
		if(abs(r)<eps)r = 0.0;
		if(abs(d)<eps)d = 0.0;
	}
	
	
	T get_dis(vector_2d<T> V){
		return hypot(x-V.x,y-V.y);
	}
	
	T angle_difference(vector_2d<T> V){
		double ret = d - V.d;
		if(ret<-acos(-1.0))ret = acos(-1.0)*2.0+ret;
		if(ret>acos(-1.0))ret=-acos(-1.0)*2.0+ret;
		return ret;
	}
	
	//中点
	vector_2d get_midpoint(vector_2d<T> V){
		V.update_x(0.5,x/2.0);
		V.update_y(0.5,y/2.0);
		return V;
	}
	
	T get_inner_product(vector_2d<T> V){
		return x*V.x+y*V.y;
	}
	
	T get_cross_product(vector_2d<T> V){
		return x*V.y-y*V.x;
	}
	
	vector_2d &operator+=(const vector_2d<T> &another){
		update_x(1,another.x);
		update_y(1,another.y);
		return (*this);
	}
	
	vector_2d &operator-=(const vector_2d<T> &another){
		update_x(1,-another.x);
		update_y(1,-another.y);
		return (*this);
	}
	
	vector_2d operator+(const vector_2d<T> &another)const{
		return (vector_2d(*this)+=another);
	}
	
	vector_2d operator-(const vector_2d<T> &another)const{
		return (vector_2d(*this)-=another);
	}
	
	void show(){
		cout<<x<<','<<y<<endl;
	}
};

template <typename T>
struct circle{
	vector_2d<T> C;
	T R;
	circle(vector_2d<T> c=vector_2d<T>(),T r=0.0){
		C = c;
		R = r;
	}
	
	vector<vector_2d<T>> get_cross_point(circle<T> C2){
		vector<vector_2d<T>> ret;

		T d = C.get_dis(C2.C);
		if(d>R+C2.R+eps)return ret;
		if(d+eps<abs(R-C2.R))return ret;
		T cosine = (pow(R,2.0)+pow(d,2.0)-pow(C2.R,2.0))/(2.0*R*d);
		
		T Rc = R*cosine;
		T Rs = sqrt(pow(R,2.0)-pow(Rc,2.0));
		
		vector_2d<T> e1 = (C2.C-C);
		e1.update_r(1.0/d,0.0);
		vector_2d<T> e2 = e1;
		e2.update_d(1.0,acos(-1.0)/2.0);
		e1.update_r(Rc,0.0);
		e2.update_r(Rs,0.0);
		ret.push_back(C + e1+e2);
		e2.update_d(1.0,-acos(-1.0));
		ret.push_back(C+e1+e2);
		return ret;
	}
};

int main(){
	
	int N,K;
	cin>>N>>K;
	
	vector<vector_2d<double>> V(N);
	vector<double> c(N);
	for(int i=0;i<N;i++){
		double x,y;
		cin>>x>>y;
		V[i] = vector_2d<double>(x,y);
		cin>>c[i];
	}
	
	double ok = 100000000.0;
	double ng = 0.0;
	
	for(int i=0;i<100;i++){
		double mid = (ok+ng)/2.0;
		vector<vector_2d<double>> L;
		for(int i=0;i<N;i++){
			L.push_back(V[i]);
			for(int j=i+1;j<N;j++){
				circle<double> C1(V[i],mid/c[i]),C2(V[j],mid/c[j]);
				auto X = C1.get_cross_point(C2);
				for(int k=0;k<X.size();k++)L.push_back(X[k]);
			}
		}
		
		bool f = false;
		for(int j=0;j<L.size();j++){
			int cnt = 0;
			for(int k=0;k<N;k++){
				if(V[k].get_dis(L[j])<=mid/c[k]+eps){
					cnt++;
				}
			}
			if(cnt>=K){
				f=true;
				break;
			}
		}
		if(f)ok = mid;
		else ng = mid;
	}
	
	cout<<fixed<<setprecision(15)<<ok<<endl;
	
	return 0;
}



Measured memory_bytes: 384