#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const double eps = 1E-18;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

ll gcd(ll a, ll b) {
	if (b == 0) { return a; }
	if (a < b) { return gcd(b, a); }
	return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint operator^(const ll& t)const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}
	// for prime MOD
	mint inv() const {
		return pow(MOD - 2);
	}
	mint& operator/=(const mint& a) {
		return (*this) *= a.inv();
	}
	mint operator/(const mint& a) const {
		mint res(*this);
		return res /= a;
	}

	friend ostream& operator<<(ostream& os, const mint& m) {
		os << m.x;
		return os;
	}
};

///////////////////////////

bool circle_intersection(pair<double, double> a[2], double r[2], pair<double,double> (&ans)[2]) {
	double x = a[1].first - a[0].first;
	double y = a[1].second - a[0].second;

	double th = atan2(y, x);

	double d = sqrt(x*x + y * y);
	if (d - r[0] - r[1] > -eps) { return 0; }
	if (r[0] - d - r[1] > -eps) { return 0; }
	if (r[1] - d - r[0] > -eps) { return 0; }

	double phi = acos((r[0] * r[0] + d * d - r[1] * r[1]) / (2.0*r[0] * d));
	
	ans[0] = { a[0].first + r[0] * cos(th + phi),a[0].second + r[0] * sin(th + phi) };
	ans[1] = { a[0].first + r[0] * cos(th - phi),a[0].second + r[0] * sin(th - phi) };

	return 1;
}

ll K, N;

vector<pair<double, double>> A;
vector<double> c;

bool heat(pair<double, double> z, double t, ll j, ll k) {
	ll count = 0;

	repn(i, N) {
		if (i == j || i == k) { count++; continue; }
		double x = A[i].first - z.first;
		double y = A[i].second - z.second;
		if (sqrt(x*x + y * y)*c[i] < t) {count++; }
	}

	if (count >= K) { return true; }
	return false;
}

bool ch(double t) {
	repn(i, N)for (ll j = i + 1; j <= N; j++) {
		pair<double, double> a[2] = { A[i],A[j] };
		double r[2] = { t/c[i],t/c[j] };
		pair<double, double> ans[2];

		if (circle_intersection(a, r, ans)) {

			//cout << a[0].first << " " << a[0].second << endl;
			//cout << a[1].first << " " << a[1].second << endl;
			//cout << r[0] << " " << r[1] << endl;

			//cout << ans[0].first << " " << ans[0].second << endl;
			//cout << ans[1].first << " " << ans[1].second << endl;

			if (heat(ans[0], t,i,j) || heat(ans[1], t,i,j)) { return true; }

			//cout << endl;
		}
	}

	repn(i, N) {
		if (heat(A[i], t,i,i)) { return true; }
	}

	return false;
}


int main() {

	cin >> N >> K;
	A.resize(N + 1);
	c.resize(N + 1);
	repn(i, N) cin >> A[i].first >> A[i].second >> c[i];

	double l = 0.0;
	double r = INF;

	ch(2.41);

	rep(i, 100) {
		double m = (l + r) / 2;

		//cout << m << endl;
		bool b = ch(m);
		//cout << b << endl;

		if (b) { r = m; }
		else { l = m; }
		


	}

	cout << fixed << setprecision(10);

	cout << r << endl;


	/*
	ll N = 4;

	rep(i, N)rep(j, N)rep(k, N)rep(l, N)rep(m, N)rep(n, N) {
		pair<double, double> a[2] = { {i,j},{k,l} };
		double r[2] = { m,n };

		pair<double,double> ans[2];

		ll b=circle_intersection(a, r,ans);

		if (b) {
			cout << i << j <<" "<< k << l << " " << m << n << endl;
			cout << ans[0].first<<ans[0].second<< " " << ans[1].first<<ans[1].second<< endl; }
		
	}

	*/

	system("PAUSE");

}

Measured memory_bytes: 512