#include <bits/stdc++.h>
////////////////////////////////////////////////////////////
#define all(x) (x).begin(), (x).end() 
const int inf = 1e9;
const long long INF=1e15;
#define endl '\n'
#define forn(i, n) for(int i=0;i<(n);++i)
#define pb push_back
#define eb emplace_back
#define fastio ios::sync_with_stdio(false);cin.tie(0); //cout.tie(0);

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<ii> vii;

using _Tp = long double;
bool equ(_Tp a, _Tp b) {
	return abs(a-b) < 1e-8;
}
struct vec {
	_Tp x, y;
	vec() {}
 	vec(_Tp const& x_, _Tp const& y_) : x(x_), y(y_) {}
 	vec operator-() {return vec(-x, -y);}
 	vec operator*(_Tp const a) {return vec(x*a, y*a);}
	vec operator/(_Tp const a) {return vec(x/a, y/a);}
	vec operator+(vec const& a) {return vec(x+a.x, y+a.y);}
	vec operator-(vec const& a) {return vec(x-a.x, y-a.y);}
	bool operator<(vec& a) {if(equ(x,a.x)) return y<a.y; else return x<a.x;}
	bool operator>(vec& a) {return a<*this;}
	vec direction() {return vec(x, y)/size();}
	vec norm() {return vec(-y, x)/size();}
	double operator*(vec const& a) {return x*a.x+y*a.y;}
	double size() {return sqrt(x*x+y*y);}
	double sizesqr() {return x*x+y*y;}
	static double angle(vec a, vec b) {
		return acos( (a*b)/(a.size()*b.size()) );
	}
	static _Tp size(vec a) {return a.size();}
	static _Tp sizesqr(vec a) {return a.sizesqr();}
	static vec intdiv(vec a, vec b, _Tp m, _Tp n) {
		return (b*m+a*n)/(m+n);
	}
	static vec extdiv(vec a, vec b, _Tp m, _Tp n) {
		return (b*m-a*n)/(m-n);
	}
	static bool isparallel(vec a, vec b) {
		if(equ(a.x, 0) && equ(b.x, 0)) return true;
		if(equ(a.x, 0) || equ(b.x, 0)) return false;
		return equ(a.y/a.x, b.y/b.x);
	}
	static _Tp ccw(vec a, vec b) {
		// if b is counter clockwise of a, this function returns (+)
		return a.x*b.y-a.y*b.x;
	}
	static _Tp ccw(vec a, vec b, vec c) {
		// where is c? (criteria of line ab)
		return ccw(b-a, c-a);
	}
	bool isintersect(vec a, vec b, vec c, vec d) {
	    _Tp ab = ccw(a,b,c)*ccw(a,b,d);
	    _Tp cd = ccw(c,d,a)*ccw(c,d,b);
	    if(ab == 0.0 && cd == 0.0) { // parallel
	        if(a > b) swap(a,b);
	        if(c > d) swap(c,d);
	        return !(b<c || d<a);
	    }
	    return ab<=0 && cd<=0; 
	}
	//#define print(V) printf("%s(%Lf,%Lf)\n", #V, V.x, V.y)
	// this code is for debugging
};
struct figure {
	int what;
	// what = 0 : line
	// what = 1 : circle
};
struct line : public figure {
	vec point, direction;
	line() {}
	line(vec p, vec d) {
		point = p;
		direction = d;
		what = 0;
	}
};
struct circle : public figure {
	vec point; _Tp radius;
	circle() {}
	circle(vec p, _Tp r) {
		point = p;
		radius = r;
		what = 1;
	}
};
int main() {
	fastio;
	int n, k; cin >> n >> k;
	vi x(n), y(n), c(n);
	forn(i, n) cin >> x[i] >> y[i] >> c[i];
	
	auto chk = [&](double t) -> bool {
		vector<circle> cirs(n);
		forn(i, n) {
			cirs[i].point = vec(x[i],y[i]);
			cirs[i].radius = t/c[i];
		}
		vector<vec> candidate;
		for(int i=0;i<n;i++) for(int j=i+1;j<n;j++) {
			circle *x = &cirs[i];
			circle *y = &cirs[j];
			auto dist = vec::size(x->point-y->point);
			auto rsum = x->radius + y->radius;
			if( !equ(dist, rsum) && dist > rsum ) continue;
			if( !equ(dist, abs(x->radius-y->radius)) && dist < abs(x->radius-y->radius) ) continue;
			auto r1 = x->radius;
			auto r2 = y->radius;
			auto a = y->point - x->point;
			auto b = a.norm();
			a = a.direction();
			auto coss = (r1*r1+dist*dist-r2*r2)/2/r1/dist;
			// I found this error..
			// cos = (a^2+b^2-c^2)/2ab not (c^2-a^2-b^2)/2ab
			auto sinn = sqrt(1-coss*coss);
			candidate.push_back(x->point + a*r1*coss + b*r1*sinn);
			candidate.push_back(x->point + a*r1*coss - b*r1*sinn);
		}
		for(int i=0;i<n;i++) {
			candidate.push_back(cirs[i].point);
		}
		for(auto c:candidate) {
			int count = 0;
			forn(i, n) {
				double d = vec::size(cirs[i].point-c);
				if( d < cirs[i].radius || equ(d,cirs[i].radius) )
					count++;
			}
			if( count >= k ) return true;
		}
		return false;
	};
	double left = 0, right = 200000;
	forn(i, 1000) {
		double mid = (left+right)/2;
		if(chk(mid)) right = mid;
		else left = mid;
	}
	cout << fixed << setprecision(6) << left;
}

Measured memory_bytes: 548