//Konrad Paluszek,University of Warsaw(former XIV LO Staszic)
//it's nice to stick a fork into an open socket
//clock says it's time to sleep
//our getppid() in heaven, hallowed by ttyname
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#define TIME (chrono::steady_clock::now().time_since_epoch().count())
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define xfm(a,b)a##b
#define xwb(a,b)xfm(a,b)
#define _ xwb(nvj,__LINE__)
#define __ xwb(kjy,__LINE__)
#define ___ xwb(cjm,__LINE__)
#define REP(i,n)for(urs(n)i=0;i<(n);++i)
#define UNTIL(t)while(clock()<(t)*CLOCKS_PER_SEC)
#define PER(r...)for(bool _=1;_||next_permutation(r);_=false)
#define ALL(r)(r).begin(),(r).end()
#define FS(r)r.first,r.second
#define sim template<class c
#define ros return o
#define rans return ans
#define forbits(i,m)if(m)for(urs(m)i=ctz(m),i##nvj=m;i##nvj;i##nvj^=((urs(m))1<<i),i=ctz(i##nvj))
#define fordbits(i,m)if(m)for(urs(m)i=8*sizeof(m)-clz(m)-1,i##nxd=m;i##nxd;i##nxd^=((urs(m))1<<i),i=8*sizeof(m)-clz(i##nxd)-1)
#define ksets(t, m, k, n) for (t m = (((t)1 << (k)) - 1); m < ((t)1 << (n)); m = nux(m))
#define urs(r...)typename decay<decltype(r)>::type
#define hur(f,g,r)sim>int f(c a){if(sizeof(c)==16)return r;if(sizeof(c)==8)return g##ll(a);return g(a);}
#define pwq(t,i) int clz(t x){return clz<int>(x)-i;}
using namespace __gnu_pbds;using namespace std;using ll=long long;using ld=long double;using ull=unsigned long long;using vi=vector<int>;using pii=pair<int,int>;using pll=pair<ll,ll>;using vpii=vector<pii>;using unt=unsigned int;sim>using min_queue=priority_queue<c,vector<c>,greater<c>>;sim,class b,class cmp=less<c> >using ordered_map=tree<c,b,cmp,rb_tree_tag,tree_order_statistics_node_update>;sim, class cmp=less<c>>using ordered_set = ordered_map<c,null_type,cmp>;hur(popc,__builtin_popcount,popc<ull>(a)+popc<ull>(a>>64))hur(ctz,__builtin_ctz,(ull)a?ctz<ull>(a):64+ctz<ull>(a>>64))hur(clz,__builtin_clz,a>>64?clz<ull>(a>>64):64+clz<ull>(a))pwq(short,16)pwq(uint16_t,16)pwq(char,24)pwq(int8_t,24)pwq(uint8_t,24)sim,class N>bool mini(c&o,const N&h){if(o>h)ros=h,1;return 0;}sim,class N>bool maxi(c&o,const N&h){if(o<h)ros=h,1;return 0;}sim,class n>using gyv=c;
#if defined(LOCAL) // || defined(LOCAL2)
namespace std {
#include </home/kjp/headers/debuglib.hpp>
}
#else
#define loc(...)
#define onl(r...)r
#define debug(...)
#define print_stack(...)
#define mark_stack(...)
#define set_pre(...)
#define reg_it(...)
#endif
#define next nexT
#define prev preV
#define tree trEE
#define left lefT
#define right righT
#define div diV
#define y1 y_1
ull mix(ull o){o+=0x9e3779b97f4a7c15;o=(o^(o>>30))*0xbf58476d1ce4e5b9;o=(o^(o>>27))*0x94d049bb133111eb;ros^(o>>31);}ull SALT=0x7a14a4b0881ebf9,tqu=0x7a14a4b0881ebf9;ull my_rand(){return tqu=mix(tqu);}void my_srand(ull x){SALT=tqu=x;}const int inf = 1023400000;const ll llinf=1234567890000000000ll;
#define rand my_rand
#define srand my_srand
#define random_shuffle(r...)random_shuffle(r,[](int _){return my_rand()%_;})
sim>inline c nux(c m){if(!m)return numeric_limits<c>::max();c A=m&-m;c B=~((A-1)^m);c C=B&-B;c D=(C>>(1+ctz(A)))-1;return C|(m&~(C-1))|D;}__attribute__((no_sanitize_undefined))ll mul(ll a,ll b,ll m){ll q=a*(ld)b/m;ll o=a*b-q*m;o%=m;if(o<0)o+=m;ros;}sim>void unq(c&x){x.resize(unique(ALL(x))-x.begin());}
#if ((ULONG_MAX) != (UINT_MAX))
namespace std {template <> struct is_signed<__int128> : public true_type {};}
#endif
#define q31 (8 * sizeof(c) - 1)
sim> typename enable_if<is_signed<c>::value, c>::type FastMax(c x, c y) { return ((x - y) >> q31 & (x ^ y)) ^ x; }
sim> typename enable_if<is_signed<c>::value, c>::type FastMin(c x, c y) { return ((x - y) >> q31 & (x ^ y)) ^ y; }
sim> typename enable_if<is_signed<c>::value, c>::type FastAbs(c x)        { return (x ^ x >> q31) - (x >> q31); }
sim> typename enable_if<is_signed<c>::value, c>::type gcd(c a, c b) {
	loc(assert(a > 0 && b > 0));
	int aa = ctz(a), bb = ctz(b);
	int r = FastMin(aa, bb);
	a >>= aa;
	while (a && b) {
		b >>= ctz(b);
		c x = FastAbs(a - b);
		a = FastMin(a, b);
		b = x;
	}
	return (a + b) << r;
}
sim> c lcm(c a, c b) {return a / gcd(a, b) * b;}
sim>typename enable_if<is_integral<c>::value,ull>::type my_hash(c x){
	if(sizeof(c)>8) return mix((ull)x^SALT)^mix((ull)(x>>64)^SALT);
	return mix(x^SALT);
}
template<size_t N>ull my_hash(const bitset<N>&x){
	return mix(hash<bitset<N>>()(x)^SALT);
}
sim,class n>ull my_hash(const pair<c,n>&);
sim>gyv<ull,typename c::value_type>my_hash(const c&x){
	ull o=SALT;
	for(auto&d:x)o=mix(o^my_hash(d));
	ros;
}
sim,class n>ull my_hash(const pair<c,n>&x){return mix(my_hash(x.first))^my_hash(x.second);}
sim>struct my_hasher{size_t operator()(const c&o)const{return my_hash(o);}};
sim, class m>
#ifdef LOCAL
using _un0rDer3d_M4P=unordered_map<c,m,my_hasher<c>>;
sim> using _un0rDer3d_5et = unordered_set<c, my_hasher<c>>;
#else
struct _un0rDer3d_M4P : public cc_hash_table<c,m,my_hasher<c>>{bool count(const c&x)const{return this->find(x) != this->end();}};
sim> using _un0rDer3d_5et = _un0rDer3d_M4P<c, null_type>;
#endif
#define unordered_map _un0rDer3d_M4P
#define unordered_set _un0rDer3d_5et
#if defined(LOCAL) || defined(LOCAL2)
void __tmi() {cerr << "total time: " << clock() / (ld)CLOCKS_PER_SEC << "s" << endl;}int _ = (atexit(__tmi), 0);
#endif
#define vsv sim,class d,class e
#define nop(o,c,r,l...)>auto operator o(const c&a,const r&b)->decltype(make_pair(l)){return{l};}
#define pcg(o) vsv,class f nop(o, pair <c u d>, pair <e u f>, a.first o b.first, a.second o b.second)vsv,class=typename enable_if<!is_base_of<ios_base,c>::value>::type nop(o,c,pair<d u e>,a o b.first,a o b.second)vsv nop(o,pair<c u d>,e,a.first o b,a.second o b)
#define clp(o) pcg(o)vsv>void operator o##=(pair<c,d>&a,const e&b){a.first o##=b;a.second o##=b;}vsv,class f>void operator o##=(pair<c,d>&a,const pair<e,f>&b){a.first o##=b.first;a.second o##=b.second;}
#define syd(o) sim,class d>auto operator o(pair<c, d> e)->decltype(make_pair(o e.first,o e.second)){return{o e.first,o e.second};}
#define u ,
clp(+)clp(-)clp(*)clp(/)clp(%)clp(^)clp(|)clp(>>)clp(<<)clp(&)pcg(&&)pcg(||)syd(-)syd(+)syd(~)syd(!)
#undef u
#define x first
#define y second
using pdd = pair <ld, ld>;
struct Point {
	int c;
	pdd x;
};
loc (ostream &operator<<(ostream &o, Point p) {ros << "[" << p.c << " at " << p.x << "]";})
const int nax = 60;
Point in[nax];
ld dist(pdd a, pdd b) {
	a -= b;
	a *= a;
	return sqrt(a.first + a.second);
}
template <class Fun> ld ternary(Fun f) {
	ld low = -1000, high = 1000;
	ld ans = numeric_limits<ld>::infinity();
	REP(_, 37) {
		ld m1 = (low * 1.1 + high) / 2.1, m2 = (low + high * 1.1) / 2.1;
		ld v1 = f(m1), v2 = f(m2);
		mini(ans, v1);
		mini(ans, v2);
		if (v1 < v2)
			high = m2;
		else
			low = m1;
	}
	debug(imie(low) - imie(high));
	rans;
}
pdd get(const vector <Point> &ps) {
	pair <ld, pdd> ans = {numeric_limits<ld>::max(), {0, 0}};
	auto eval = [&](pdd x) {
		ld r = 0;
		for (Point p : ps)
			maxi(r, dist(p.x, x) * p.c);
		mini(ans, make_pair(r, x));
		return r;
	};
	auto t1 = [&](ld x) {
		return ternary([&](ld y){return eval({x, y});});
	};
	ternary(t1);
	debug(imie(ps), imie(ans));
	rans.second;
}
using ld = long double;
const ld eps = 1e-8;
ld K(ld a) {return a * a;}
using P = pdd;
ld vec(P a, P b) {return a.x * b.y - a.y * b.x;}
ld sca(P a, P b) {return a.x * b.x + a.y * b.y;}
ld sq_dist(P a, P b) {
	a = a - b;
	return K(a.first) + K(a.second);
}
ld roundpow2(ld x) {
	ld y = 1;
	while (y > x) y /= 2;
	while (y < x) y *= 2;
	return y;
}
bool iszero(ld x) {return abs(x) < eps;}
struct L {
	ld a, b, c; //ax + by = c
	L(ld a_ = 0, ld b_ = 0, ld c_ = 0) : a(a_), b(b_), c(c_) {
		//potrzebne tylko jak "intensywnie używamy" przecięć i wyznaczania prostej przez punkty
		//bez tego można dać pusty konstruktor
		ld s = sqrt(K(a) + K(b));
		s = roundpow2(s); //Tylko dlatego, że mnożenie/dzielenie przez potęgę dwójki nie gubi dokładności. 
		a /= s; b /= s; c /= s;
	}
	P v() {return {a, b};}
};
ld norm2(P a) {return K(a.first) + K(a.second);}
ld norm(P a) {return sqrt(norm2(a));}
struct C {P o; ld r;};
P rot(P a) {return {a.y, -a.x};}
L line_by_vec(P vec, P o) {return L(vec.x, vec.y, sca(vec, o));}
L make_line(P a, P b) {return L(a.y - b.y, b.x - a.x, vec(b, a));}
P project(L l, P p) {
	P v = l.v();
	return p - v * (l.a * p.x + l.b * p.y - l.c) / norm2(v);
}
ld dist(L l, P p) {
	return abs(l.a * p.x + l.b * p.y - l.c) / sqrt(l.a * l.a + l.b * l.b);
}
P symmetry(L l, P p) {//Wszystkie symetrie: Symetria(środek/oś, obiekt)
	P v = l.v();
	return p - 2 * v * (l.a * p.x + l.b * p.y - l.c) / norm2(v);
}
L symmetry(L l, L l1) {
	ld Q = 2 * (l1.a * l.a + l1.b * l.b) / (K(l.a) + K(l.b));
	return L(l1.a - l.a * Q, l1.b - l.b * Q, l1.c - l.c * Q);
}
C symmetry(L l, C c){return C{symmetry(l, c.o), c.r};} 
P symmetry(P o, P x){return 2 * o - x;} 
L symmetry(P o, L l){return L{l.a, l.b, 2 * o.x * l.a + 2 * o.y * l.b - l.c};} 
C symmetry(P l, C c){return C{symmetry(l, c.o), c.r};} 
P inter(L k, L l) {
	#define Q(i, j) (k.i * l.j - k.j * l.i) //Koniecznie w nawiasach!!!!!!!
	return P{Q(c, b) / Q(a, b), Q(a, c) / Q(a, b)};
	#undef Q
}
vector <P> inter(C c, L l) {
	ld h = dist(l, c.o);
	if (iszero(h - c.r)) return {project(l, c.o)};
	if (h > c.r) return {};
	ld k = sqrt(K(c.r) - K(h));
	P o = project(l, c.o);
	P d = rot(l.v());
	d *= k / norm(d);
	return {o - d, o + d};
}
vector <P> inter(C a, C b) {
	ld l = dist(a.o, b.o);
	if (l > a.r + b.r + eps || l < abs(a.r - b.r) - eps || l < eps) return {};
	return inter(a, L(2 * (a.o.x - b.o.x), 2 * (a.o.y - b.o.y),
				            K(b.r) - K(a.r) - norm2(b.o) + norm2(a.o)));
}
//rotate(środek, kąt, obiekt)
P rotate(P o, ld alpha, P x) {return o + (x - o) * P{cos(alpha), sin(alpha)};}
L rotate(P o, ld alpha, L l) {
	ld si = sin(alpha), co = cos(alpha);
	return L(l.a * co - l.b * si, l.a * si + l.b * co,
		l.c - l.a * (o.x * (1 - co) - o.y * si) - l.b * (o.y * (1 - co) + o.x * si));
}
C rotate(P o, ld alpha, C c) {return C{rotate(o, alpha, c.o), c.r};}
P scale(P o, ld sc, P x) {return x * sc + o * (1 - sc);}
C scale(P o, ld sc, C c) {return C{scale(o, sc, c.o), c.r * abs(sc)};}
L scale(P o, ld sc, L l) {
	return L(l.a / sc, l.b / sc, l.c - (l.a * o.x + l.b * o.y) * (1 - 1 / sc));
}
vector <L> tangent(C c, P p) {
	ld l = dist(c.o, p);
	if (l < c.r - eps) return {};
	if (l < c.r + eps) return {line_by_vec(p - c.o, p)};
	P to = p - c.o;
	to *= c.r / norm(to);
	ld co = c.r / l;
	ld si = sqrt(1 - K(co));
	P x = to * P{co, si};
	P y = to * P{co, -si};
	return {line_by_vec(x, c.o + x), line_by_vec(y, c.o + y)};
}
vector <L> tangent(C a, C b) { //Jeśli trzeba, to doifować case'y, kiedy któryś okrag ma promień 0
	vector <P> which;
	ld l = dist(a.o, b.o);
	if (l < eps) return {};
	P to = b.o - a.o;
	to *= a.r / norm(to);
	for (int d = -1; d <= 1; d += 2) {//d=-1 zewnętrzna styczna, d=1 wewnętrzna
		ld rr = a.r + b.r * d;
		if (abs(rr) > l + eps) continue;
		if (abs(rr) > l - eps) {
			if (rr > 0) which.emplace_back(1, 0);
			else which.emplace_back(-1, 0);
		}
		else {
			ld co = rr / l;
			ld si = sqrt(1 - K(co));
			which.emplace_back(co, si);
			which.emplace_back(co, -si);
		}
	}
	vector <L> ans;
	for (P x : which) {
		P y = x * to;
		ans.push_back(line_by_vec(y, a.o + y));
	}
	return ans;
}
L parallel(L l, P x) {return L(l.a, l.b, l.a * x.x + l.b * x.y);}
L perpendicular(L l, P x) {return L(l.b, -l.a, l.b * x.x - l.a * x.y);}
ld angle(P A, P O, P B) {//miara kąta AOB
	ld a = dist(A, O), b = dist(B, O), c = dist(A, B);
	ld co = (K(a) + K(b) - K(c)) / (2 * a * b);
	if (co > 1) co = 1;
	if (co < -1) co = -1;
	ld alpha = acos(co);
	if (vec(B - O, A - O) < 0)
		alpha = -alpha;
	return alpha;
}
L angle_bisector(P A, P O, P B) {//Dwusieczna kąta wewnętrznego
	ld a = dist(A, O);
	ld b = dist(O, B);
	return make_line(O, (A * b + B * a) / (a + b));
}
L segment_bisector(P a, P b) {
	return L(-2 * (b.x - a.x), -2 * (b.y - a.y) , norm2(a) - norm2(b));
}
ld det(ld a[3][3]) {
	ld r = 0; int s = 0;
	for (int i = 0; i < 3; ++i) for (int j = 0; j < 3; ++j) if (i - j)
		r += (1 - (++s & 2)) * a[i][0] * a[j][1] * a[i ^ j ^ 3][2];
	return r;
}
bool collinear(P a, P b, P c) {
	ld x[3][3] = {a.x, a.y, 1, b.x, b.y, 1, c.x, c.y, 1};
	return iszero(det(x));
}
bool concurrent(L k, L l, L m) {
	ld x[3][3] = {k.a, k.b, k.c, l.a, l.b, l.c, m.a, m.b, m.c};
	return iszero(det(x));
}
bool parallel(L k, L l) {return iszero(k.a * l.b - k.b * l.a);}
bool perpendicular(L k, L l) {return iszero(k.a * l.a + k.b * l.b);}
bool on_line(L l, P p) {return iszero(l.a * p.x + l.b * p.y - l.c);}
bool on_circle(C c, P p) {return iszero(c.r - dist(p, c.o));}
P on(L x, ld t) {
	P r = P{x.a, x.b} / norm2(x.v()) * x.c + t * P{-x.b, x.a};
	return r;
}
ld vec(P a, P b, P c) {
	return vec(a, b) + vec(b, c) + vec(c, a);
}
L get_line(Point a, Point b) {
	assert(a.c == b.c);
	return line_by_vec(a.x - b.x, (a.x + b.x) / 2);
}
C diam(P a, P b) {
	return {(a + b) / 2, dist(a, b) / 2};
}
pdd cen(pdd a, ld va, pdd b, ld vb) {
	return (a * va + b * vb) / (va + vb);
}
C get_circ(Point a, Point b) {
	assert(a.c != b.c);
	return diam(cen(a.x, a.c, b.x, b.c), cen(a.x, a.c, b.x, -b.c));
}
vector <pdd> get2(const vector <Point> &ps) {
	if (ps.size() == 2u) {
		return {(ps[0].x * ps[0].c + ps[1].x * ps[1].c) / (ps[0].c + ps[1].c)};
	}
	assert(ps.size() == 3u);
	Point A = ps[0], B = ps[1], C = ps[2];
	if (A.c == B.c) {
		L ab = get_line(A, B);
		if (A.c == C.c) {
			L ac = get_line(A, C);
			return {inter(ab, ac)};
		}
		else {
			::C ac = get_circ(A, C);
			return inter(ac, ab);
		}
	}
	else {
		::C ab = get_circ(A, B);
		if (A.c == C.c) {
			L ac = get_line(A, C);
			return inter(ab, ac);
		}
		else {
			::C ac = get_circ(A, C);
			return inter(ab, ac);
		}
	}
}
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	if (k == 1) {
		printf("0.000000\n");
		exit(0);
	}
	REP(i, n) {
		int x, y, c;
		scanf("%d%d%d", &x, &y, &c);
		in[i] = {c, {x, y}};
	}
	vector <pdd> cans;
	REP(i, n) REP(j, i) {
		for (pdd p :  get2({in[i], in[j]}))
			cans.push_back(p);
	}
	REP(i, n) REP(j, i) REP(q, j) {
		for (pdd p : get2({in[i], in[j], in[q]}))
			cans.push_back(p);
	}
	ld best = numeric_limits<ld>::infinity();
	for (pdd c : cans) {
		vector <ld> times(n);
		REP(i, n) times[i] = in[i].c * dist(in[i].x, c);
		nth_element(times.begin(), times.begin() + k - 1, times.end());
		mini(best, times[k - 1]);
	}
	printf("%.10Lf\n", best);
}


Measured memory_bytes: 1400