#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma warning(disable : 4996)
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include<random>
#include<array>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;++i)
#define REPR(i, n) for(int i = n-1;i >= 0;--i)
#define FOR(i, m, n) for(int i = m;i < n;++i)
#define FORR(i, m, n) for(int i = m-1;i >= n;--i)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end())
#define ll long long
#define pb(a) push_back
#define print(x) cout<<(x)<<'\n'
#define pe(x) cout<<(x)<<" "
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define lb(v,n) lower_bound(v.begin(), v.end(), (n))
#define ub(v,n) upper_bound(v.begin(), v.end(), (n))
#define int long long
//#define double long double
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ")
template<typename T1, typename T2> inline void chmin(T1 & a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
//typedef pair<int, int>P;
const int MOD = 1e9 + 7; const int MAX = 200020;
const double pi = acos(-1); const double EPS = 1e-8;
const ll INF = 1e12;
typedef complex<double> point;
namespace std {
	bool operator < (const point& a, const point& b) {
		return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
	}
}
double cross(const point& a, const point& b) {
	return imag(conj(a)*b);
}
double dot(const point& a, const point& b) {
	return real(conj(a)*b);
}
double distancePP(const point& a, const point& b) {
	return sqrt(norm(a - b));
}
struct L : public vector<point> {
	L(const point &a, const point &b) {
		push_back(a); push_back(b);
	}
};

typedef vector<point> G;

struct C {
	point p; double r;
	C(const point &p, double r) : p(p), r(r) { }
};

pair<point, point> circle_circle_intersect(
	const point& c1, const double& r1, const point& c2, const double& r2) {
	point A = conj(c2 - c1), B = (r2*r2 - r1 * r1 - (c2 - c1)*conj(c2 - c1)), C = r1 * r1*(c2 - c1);
	point D = B * B - 4.0*A*C;
	point z1 = (-B + sqrt(D)) / (2.0*A) + c1, z2 = (-B - sqrt(D)) / (2.0*A) + c1;
	return pair<point, point>(z1, z2);
}


void solve() {
	int N, K; cin >> N >> K;
	vector<double>C(N);
	vector<point>v(N);
	REP(i, N) {
		double x, y; cin >> x >> y >> C[i];
		point p = { x,y };
		v[i] = p;
	}
	double ok = 1e9, ng = 0;
	//print(distancePP(point(-2, 0), point(1, 3)));
	REP(_, 100) {
		double mid = (ok + ng) / 2;
		//print(mid);
		vector<double>R(N);

		REP(i, N) {
			R[i] = mid / C[i];
		}
		bool possible = false;
		vector<point>ps;
		REP(i, N) {
			ps.push_back(v[i]);
		}
		REP(i, N) {
			REP(j, N) {
				double mx = max(R[i], R[j]), mn = min(R[i], R[j]);
				double d = distancePP(v[i], v[j]);
				if (mx - mn-EPS <= d && d <= mx + mn+EPS) {
					pair<point, point>pp = circle_circle_intersect(v[i], R[i], v[j], R[j]);
					ps.push_back(pp.first);
					ps.push_back(pp.second);
				}
			}
		}
		for (point p : ps) {
			int cnt = 0;
			REP(i, N) {
				if (distancePP(p, v[i]) <= R[i]+EPS)cnt++;
			}
			if (cnt >= K)possible = true;
		}
		if (possible)ok = mid;
		else ng = mid;
	}
	cout << setprecision(10) << ok << endl;
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//int q; cin >> q;
	//while (q--)
	solve();
}


Measured memory_bytes: 512