#include <bits/stdc++.h>
using namespace std;

#define mainspring cout<<"mainspring\n";
#define barrel cout<<"barrel\n";
#define escapement cout<<"escapement\n";

#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end() 
#define sz(v) (int)((v).size())
#define fs first
#define sd second
#define tik(i,a,b) for(int i = a; i < b; i++)
#define tok(i,a,b) for(int i = a; i >= b; i--)
#define error(args...) {string _s = #args; replace(_s.begin(), _s.end(), ',',' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it,args);}

typedef long long ll;
typedef unsigned long long ull;

typedef pair < int, int > pi;
typedef pair < pi, int > ppi;

typedef vector < int > vi;
typedef vector < vector < int > > vvi;
typedef vector < pi > vpi;
typedef vector < vpi > vvpi;
typedef vector < ppi > vppi;

void fast() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " ";
    err(++it, args...);
}

ll pow(ll x, ll y) {
	if(y == 0)
	return 1;
	ll temp = pow(x, y/2);
	temp = (temp*temp);
	if(y%2 == 1)
		temp *= x;
	return temp;
}

#define ld long double
const ld EPS = 1E-10	;

int main() {
	int n, k;
	cin >> n >> k;
	ld x[n], y[n], c[n];
	for(int i =0; i < n; i++)
		cin >> x[i] >> y[i] >> c[i];
	ld lo = 0, hi = 4E6;
	int operations = 0;
	int times=60;
	if(k == 1) {
		cout << 0;
		return 0;
	}
	while(times--) {
		operations++;
		bool ok = 0;
		ld mid = (lo + hi)/2;
		for(int i = 0; i < n; i++) {
			for(int j = i + 1; j < n; j++) {
				int cnt1 = 0, cnt2 = 0;
				ld r1 = (mid/c[i]), r2 = (mid/c[j]);
				ld x1 = x[i], x2 = x[j], y1 = y[i], y2 = y[j];
				ld xint1, yint1, xint2, yint2;
				ld R = sqrtl((x1 - x2)*(x1 - x2) + (y1 - y2)*(y1 - y2));
				xint1 = x1 + r1, yint1 = y1, xint2 = x2 + r2, yint2 = y2;
				for(int k = 0; k < n; k++) {
					ld d = sqrtl((x[k]- xint1)*(x[k] - xint1) + (y[k] - yint1)*(y[k] - yint1));
					//error(xint1, yint1);
					cnt1 += (c[k]*d < EPS + mid);
				}
				for(int k = 0; k < n; k++) {
					ld d = sqrtl((x[k] - xint2)*(x[k] - xint2) + (y[k] - yint2)*(y[k] - yint2));
					cnt2 += (c[k]*d < EPS + mid);
				}
				if(cnt1 >= k || cnt2 >= k)
					ok = 1;
				cnt1 = 0, cnt2 = 0;
				if(r1 + r2 + EPS < R)
					continue;
				xint1 = xint2 = (x1 + x2)/2 + (r1*r1 - r2*r2)/(2*R*R)*(x2 - x1);
				yint1 = yint2 = (y1 + y2)/2 + (r1*r1 - r2*r2)/(2*R*R)*(y2 - y1);
				xint1 += (y2 - y1)*0.5*sqrtl(max(2*(r1*r1 + r2*r2)/(R*R) - (r1*r1 - r2*r2)*(r1*r1 - r2*r2)/(R*R*R*R) - 1	, (ld)0));
				xint2 -= (y2 - y1)*0.5*sqrtl(max(2*(r1*r1 + r2*r2)/(R*R) - (r1*r1 - r2*r2)*(r1*r1 - r2*r2)/(R*R*R*R) - 1, (ld)0));
				yint1 += (x1 - x2)*0.5*sqrtl(max(2*(r1*r1 + r2*r2)/(R*R) - (r1*r1 - r2*r2)*(r1*r1 - r2*r2)/(R*R*R*R) - 1, (ld)0));
				yint2 -= (x1 - x2)* 0.5*sqrtl(max(2*(r1*r1 + r2*r2)/(R*R) - (r1*r1 - r2*r2)*(r1*r1 - r2*r2)/(R*R*R*R) - 1, (ld)0));
				// error(xint1, yint1);
				for(int k = 0; k < n; k++) {
					ld d = sqrtl((x[k]- xint1)*(x[k] - xint1) + (y[k] - yint1)*(y[k] - yint1));
					//error(xint1, yint1);
					cnt1 += (c[k]*d < EPS + mid);
				}
				for(int k = 0; k < n; k++) {
					ld d = sqrtl((x[k] - xint2)*(x[k] - xint2) + (y[k] - yint2)*(y[k] - yint2));
					cnt2 += (c[k]*d < EPS + mid);
				}
				if(cnt1 >= k || cnt2 >= k)
					ok = 1;
			}
		}
		//error(mid, lo, hi, ok);
		if(ok) {
			//mid is valid answer
			hi = mid;
		}
		else
			lo = mid;
	}
	cout << fixed << setprecision(15) << lo;
}

Measured memory_bytes: 384