#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <bitset>
#include <iterator>
#include <deque>
#include <string>
#include <queue>

using namespace std;
const double INF=1e10;

class vector2d{
public:
	double x;
	double y;
	vector2d(){
		x=0;
		y=0;
	}
	vector2d(const double x,const double y){
		this->x=x;
		this->y=y;
	}
	double norm() const{
		return sqrt(x*x+y*y);
	}
	double arg() const{
		return atan2(y,x);
	}
	vector2d operator-(const vector2d& d) const{
		return vector2d(x-d.x,y-d.y);
	}
	vector2d operator+(const vector2d& d) const{
		return vector2d(x+d.x,y+d.y);
	}
	vector2d& operator-=(const vector2d& d){
		x-=d.x;
		y-=d.y;
		return *this;
	}
	vector2d& operator+=(const vector2d& d){
		x+=d.x;
		y+=d.y;
		return *this;
	}
	vector2d operator*(const double d) const{
		vector2d retval(*this);
		retval*=d;
		return retval;
	}
	vector2d& operator*=(const double d){
		x*=d;
		y*=d;
		return *this;
	}
	vector2d operator/(const double d) const{
		vector2d retval(*this);
		retval/=d;
		return retval;
	}
	vector2d& operator/=(const double d){
		x/=d;
		y/=d;
		return *this;
	}
	double dot(const vector2d& d) const{
		return x*d.x+y*d.y;
	}
	vector2d orthogonal() const{
		return vector2d(y,-x);
	}
};
std::ostream& operator<<(std::ostream& it,const vector2d &obj){
	return it<<"("<<obj.x<<","<<obj.y<<")";

}

vector2d operator*(const double a,const vector2d& b){
	return b*a;
}

struct Niku{
	vector2d pos;
	double c;
};
int64_t k;

double calc_time(vector<Niku> *yn,vector2d pos){
	vector<double> time_list;
	for(auto i1=yn->begin();i1!=yn->end();i1++){
		double time=(i1->c)*(pos-(i1->pos)).norm();
		time_list.push_back(time);
	}
	sort(time_list.begin(),time_list.end());
	return time_list[k-1];
}
double EPS=1e-6;
int main(){
	int64_t n;
	cin>>n>>k;
	vector<Niku> yn;
	for(int64_t i1=0;i1<n;i1++){
		double x,y,c;
		cin>>x>>y>>c;
		Niku prepare;
		prepare.pos.x=x;
		prepare.pos.y=y;
		prepare.c=c;
		yn.push_back(prepare);
	}
	if(k==1){
		cout<<0<<endl;
	}else{
		double min_value=INF;
		for(int64_t niku1=0;niku1<n-1;niku1++){
			for(int64_t niku2=niku1+1;niku2<n;niku2++){
				vector2d pos_temp = (yn[niku1].c*yn[niku1].pos+yn[niku2].pos*yn[niku2].c)/(yn[niku1].c+yn[niku2].c);
				double time_temp = calc_time(&yn,pos_temp);
				if(time_temp<min_value){
					min_value=time_temp;
				}
			}
		}
		for(int64_t niku1=0;niku1<n-2;niku1++){
			for(int64_t niku2=niku1+1;niku2<n-1;niku2++){
				for(int64_t niku3=niku2+1;niku3<n;niku3++){
					vector2d line_c,line_v;
					vector2d circle_c;
					bool mid_calc=false;
					double circle_radius;
					if(abs(yn[niku1].c-yn[niku2].c)<EPS){
						if(abs(yn[niku1].c-yn[niku3].c)<EPS){
							//どっちも直線
							vector2d c1=yn[niku1].pos*0.5+yn[niku3].pos*0.5;
							vector2d v1 = (yn[niku1].pos-yn[niku3].pos).orthogonal();
							vector2d c2=yn[niku1].pos*0.5+yn[niku2].pos*0.5;
							vector2d v2 = (yn[niku1].pos-yn[niku2].pos).orthogonal();
							if(abs(v1.dot(v1)*v2.dot(v2)-v1.dot(v2)*v1.dot(v2))<EPS){
								continue;
							}
							double beta =(c1.dot(v1)*v1.dot(v2)-c1.dot(v2)*v1.dot(v1)-c2.dot(v1)*v1.dot(v2)+c2.dot(v2)*v1.dot(v1));
							beta /= (v1.dot(v2)*v1.dot(v2)-v1.dot(v1)*v2.dot(v2));
							vector2d pos_temp = c2+beta*v2;
							double time_temp=calc_time(&yn,pos_temp);
							if(time_temp<min_value){
								min_value=time_temp;
							}
						}else{
							line_c = yn[niku1].pos*0.5+yn[niku2].pos*0.5;
							line_v = (yn[niku1].pos-yn[niku2].pos).orthogonal();
							vector2d pos1 = (yn[niku1].pos*yn[niku1].c+yn[niku3].pos*yn[niku3].c)/(yn[niku1].c+yn[niku3].c);
							vector2d pos2 = (yn[niku1].pos*yn[niku1].c-yn[niku3].pos*yn[niku3].c)/(yn[niku1].c-yn[niku3].c);
							circle_c = (pos1+pos2)/2.0;
							circle_radius = (pos2-pos1).norm()/2.0;
							mid_calc=true;
						}
					}else{
						if(abs(yn[niku1].c-yn[niku3].c)<EPS){
							line_c = yn[niku1].pos*0.5+yn[niku3].pos*0.5;
							line_v = (yn[niku1].pos-yn[niku3].pos).orthogonal();
							vector2d pos1 = (yn[niku1].pos*yn[niku1].c+yn[niku2].pos*yn[niku2].c)/(yn[niku1].c+yn[niku2].c);
							vector2d pos2 = (yn[niku1].pos*yn[niku1].c-yn[niku2].pos*yn[niku2].c)/(yn[niku1].c-yn[niku2].c);
							circle_c = (pos1+pos2)/2.0;
							circle_radius = (pos2-pos1).norm()/2.0;
							mid_calc=true;
						}else{
							vector2d pos1_1 = (yn[niku1].pos*yn[niku1].c+yn[niku2].pos*yn[niku2].c)/(yn[niku1].c+yn[niku2].c);
							vector2d pos1_2 = (yn[niku1].pos*yn[niku1].c-yn[niku2].pos*yn[niku2].c)/(yn[niku1].c-yn[niku2].c);
							vector2d pos2_1 = (yn[niku1].pos*yn[niku1].c+yn[niku3].pos*yn[niku3].c)/(yn[niku1].c+yn[niku3].c);
							vector2d pos2_2 = (yn[niku1].pos*yn[niku1].c-yn[niku3].pos*yn[niku3].c)/(yn[niku1].c-yn[niku3].c);
							vector2d c1 = (pos1_1+pos1_2)/2.0;
							double r1 = (pos1_1-pos1_2).norm()/2.0;
							vector2d c2 = (pos2_1+pos2_2)/2.0;
							double r2 = (pos2_2-pos2_1).norm()/2.0;
							if(r1+r2+EPS<(c1-c2).norm()||abs(r1-r2)>(c1-c2).norm()+EPS){
								continue;
							}
							if((c1-c2).norm()<EPS){
								continue;
							}
							double cos_theta = (r1*r1+(c2-c1).dot(c2-c1)-r2*r2)/(2*r1*(c2-c1).norm());
							if(cos_theta <-1){
								cos_theta=-1;
							}else if(cos_theta >1){
								cos_theta=1;
							}
							double theta1 = acos(cos_theta)+(c2-c1).arg();
							double theta2 = -acos(cos_theta)+(c2-c1).arg();
							vector2d pos_temp = c1 + vector2d(r1*cos(theta1),r1*sin(theta1));
							double time_temp = calc_time(&yn,pos_temp);
							if(time_temp<min_value){
								min_value=time_temp;
							}
							pos_temp = c1 + vector2d(r1*cos(theta2),r1*sin(theta2));
							time_temp = calc_time(&yn,pos_temp);
							if(time_temp<min_value){
								min_value=time_temp;
							}
						}
					}
					if(mid_calc){
						vector2d rev = line_c-circle_c;

						double distance = rev.dot(line_v)*rev.dot(line_v)-line_v.dot(line_v)*(rev.dot(rev)-circle_radius*circle_radius);
						if(distance<-EPS){
							continue;
						}else if(distance<0){
							distance=0;
						}
						double alpha1 = (-rev.dot(line_v)+sqrt(distance))/(line_v.dot(line_v));
						double alpha2 = (-rev.dot(line_v)-sqrt(distance))/(line_v.dot(line_v));
						vector2d pos_temp = line_c+alpha1*line_v;
						double time_temp = calc_time(&yn,pos_temp);
						if(time_temp<min_value){
							min_value=time_temp;
						}
						pos_temp = line_c+alpha2*line_v;
						time_temp = calc_time(&yn,pos_temp);
						if(time_temp<min_value){
							min_value=time_temp;
						}

					}
				}
			}
		}
		cout<<setprecision(10)<<min_value<<endl;

	}
}


Measured memory_bytes: 512