#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
 
#define ALL(obj) (obj).begin(),(obj).end()
#define SPEED cin.tie(0);ios::sync_with_stdio(false);
 
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T,vector<T>,greater<T>>;
 
constexpr long long MOD = (long long)1e9 + 7;
constexpr long long MOD2 = 998244353;
constexpr long long HIGHINF = (long long)1e18;
constexpr long long LOWINF = (long long)1e15;
constexpr long double PI = 3.1415926535897932384626433;
 
template <class T> vector<T> multivector(size_t N,T init){return vector<T>(N,init);}
template <class... T> auto multivector(size_t N,T... t){return vector<decltype(multivector(t...))>(N,multivector(t...));}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; exit(0);}}
template <class T, class U>ostream &operator<<(ostream &o, const map<T, U>&obj) {o << "{"; for (auto &x : obj) o << " {" << x.first << " : " << x.second << "}" << ","; o << " }"; return o;}
template <class T>ostream &operator<<(ostream &o, const set<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const multiset<T>&obj) {o << "{"; for (auto itr = obj.begin(); itr != obj.end(); ++itr) o << (itr != obj.begin() ? ", " : "") << *itr; o << "}"; return o;}
template <class T>ostream &operator<<(ostream &o, const vector<T>&obj) {o << "{"; for (int i = 0; i < (int)obj.size(); ++i)o << (i > 0 ? ", " : "") << obj[i]; o << "}"; return o;}
template <class T, class U>ostream &operator<<(ostream &o, const pair<T, U>&obj) {o << "{" << obj.first << ", " << obj.second << "}"; return o;}
void print(void) {cout << endl;}
template <class Head> void print(Head&& head) {cout << head;print();}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head << " ";print(forward<Tail>(tail)...);}
template <class T> void chmax(T& a, const T b){a=max(a,b);}
template <class T> void chmin(T& a, const T b){a=min(a,b);}
void YN(bool flg) {cout << (flg ? "YES" : "NO") << endl;}
void Yn(bool flg) {cout << (flg ? "Yes" : "No") << endl;}
void yn(bool flg) {cout << (flg ? "yes" : "no") << endl;}


//Euclidean distance
template<class T> inline T EucDist(T x1, T y1, T x2, T y2) {
    return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
}

template<class T> inline vector<pair<T,T>> CircleIntersection(pair<T,T> p1, T r1, pair<T,T> p2, T r2, T eps = 1e-6) {
	vector<pair<T,T>> res;
	T x1 = p1.first;
	T y1 = p1.second;
	T x2 = p2.first;
	T y2 = p2.second;
	if(abs(x1-x2) < eps && abs(y1-y2) < eps && abs(r1-r2) < eps) return res;
	if(r1 + r2 + eps < sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2))) return res;
	T a = 2*(x1-x2);
	T b = 2*(y1-y2);
	T c = -(x1*x1-x2*x2) - (y1*y1-y2*y2) + (r1*r1 - r2*r2);
	T d = a*x1+b*y1+c;
	T e = (a*a+b*b)*r1*r1-d*d;
	if(e<0) return res;
	e = sqrt(e);
	T x3 = (-a*d+b*e)/(a*a+b*b) + x1;
	T y3 = (-b*d-a*e)/(a*a+b*b) + y1;
	T x4 = (-a*d-b*e)/(a*a+b*b) + x1;
	T y4 = (-b*d+a*e)/(a*a+b*b) + y1;
	res.push_back({x3,y3});
	res.push_back({x4,y4});
	return res;
}

int main() {
	SPEED
	int N,K; cin >> N >> K;
	vector<double> x(N),y(N),c(N);
	for(int i = 0; i < N; ++i) cin >> x[i] >> y[i] >> c[i];
	double ok = 100000000, ng = 0;
	double eps = 0.00001;
	for(int n = 0; n <= 1000; n++){
		double md = (ok+ng)/2;
		vector<pair<double,double>> cnd;
		for(int i = 0; i < N; ++i) {
			cnd.push_back({x[i],y[i]});
			for(int j = i+1; j < N; ++j){
				double r1 = md/c[i], r2 = md/c[j];
				auto v = CircleIntersection<double>({x[i],y[i]},r1,{x[j],y[j]},r2,eps);
				for(auto&e:v) cnd.push_back(e);
			}
		}
		
		int flg = 0;
		for(auto p:cnd) {
			double px = p.first, py = p.second;
			int sum = 0;
			for(int j = 0; j < N; ++j){
				double d = EucDist(px,py,x[j],y[j])*c[j];
				if(d<=md+eps) sum++;
			}
			if(sum>=K) flg = 1;
		}
		(flg?ok:ng)=md;
	}
	printf("%.10f",ok);
    return 0;
}

Measured memory_bytes: 384