#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> T MV(T v) { return v; }
template<typename T, typename ... U> auto MV(T v, int a, U ... b) { return vector<decltype(MV(v, b ...))>(a, MV(v, b ...)); }

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

int main() {
	IN(int, n, k);
	auto v = MV(0, n, 3);
	cin >> v;
	
	if(k == 1) { OUT(0); return 0; }
	
	using P = pair<double, double>;
	auto kouten = [&](int i, int j, double t) -> vector<P> {
		double x = v[j][0] - v[i][0];
		double y = v[j][1] - v[i][1];
		double ri = t / v[i][2];
		double rj = t / v[j][2];
		double a = (x*x + y*y + ri*ri - rj*rj) / 2;
		
		if((x*x + y*y)*ri*ri - a*a < 0) { return {
			{ v[i][0], v[i][1] },
			{ v[j][0], v[j][1] }
		}; }
		double ans_x1 = (a*x + y*sqrt((x*x + y*y)*ri*ri - a*a)) / (x*x + y*y) + v[i][0];
		double ans_x2 = (a*x - y*sqrt((x*x + y*y)*ri*ri - a*a)) / (x*x + y*y) + v[i][0];
		double ans_y1 = (a*y - x*sqrt((x*x + y*y)*ri*ri - a*a)) / (x*x + y*y) + v[i][1];
		double ans_y2 = (a*y + x*sqrt((x*x + y*y)*ri*ri - a*a)) / (x*x + y*y) + v[i][1];
		return {
			{ ans_x1, ans_y1 },
			{ ans_x2, ans_y2 }
		};
	};
	
	auto dist = [](double x1, double y1, double x2, double y2) {
		return sqrt((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
	};
	
	auto c = [&](P p, double t) {
		int cc = 0;
		inc(i, n) {
			if(dist(v[i][0], v[i][1], p.FI, p.SE) * v[i][2] <= t + 0.000000001) { cc++; }
		}
		return cc;
	};
	
	auto f = [&](double t) {
		inc(i, n) {
		inc(j, i) {
			auto p = kouten(i, j, t);
			RF(e, p) { if(c(e, t) >= k) { return true; } }
		}
		}
		return false;
	};
	
	double L = 0, H = 5e5;
	inc(q, 50) {
		double M = (L + H) / 2;
		(f(M) ? H : L) = M;
	}
	printf("%.9f\n", H);
}


Measured memory_bytes: 256