#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long  double EPS = 1e-8;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;

long double dis(long double a, long double b, long double c, long double d) {
	return sqrt(pow(a - c, 2) + pow(b - d, 2));
}

template<class T>
vector<pair<T, T>>CircleCross(pair<pair<T, T>, T>p, pair<pair<T, T>, T>q) {
	T a, b;
	if (abs(q.first.second - p.first.second) < EPS) {
		a = (p.second*p.second - q.second*q.second + (p.first.first - q.first.first)*(p.first.first - q.first.first)) / 2 / abs((p.first.first - q.first.first));
		vector<pair<T, T>>ret;
		if (a - EPS > p.second)return ret;
		if (a + EPS >= p.second) {
			ret.emplace_back(min(p.first.first, q.first.first) + a, p.first.second);
			return ret;
		}
		//cout << "JO" << endl;
		b = sqrt(p.second*p.second - a * a);
		ret.emplace_back(min(p.first.first, q.first.first) + a, p.first.second + b);
		ret.emplace_back(min(p.first.first, q.first.first) + a, p.first.second - b);
		return ret;
	}
	a = (p.first.first - q.first.first) / (q.first.second - p.first.second);
	b = (p.second*p.second - q.second*q.second - p.first.first*p.first.first + q.first.first*q.first.first - p.first.second*p.first.second + q.first.second*q.first.second) / 2 / (q.first.second - p.first.second);
	T A, B, C;
	A = 1 + a * a;
	B = -2 * p.first.first + 2 * a*b - 2 * a*p.first.second;
	C = p.first.first*p.first.first + b * b - 2 * b*p.first.second + p.first.second*p.first.second - p.second*p.second;
	vector<pair<T, T>>ret;
	//cout << a << " " << b << endl;
	//cout << A << " " << B << " " << C << endl;
	//cout << B * B - 4 * A*C << endl;
	if (B*B - 4 * A*C > 0) {
		T x = (-B + sqrt(B*B - 4 * A*C)) / 2 / A;
		T y = a * x + b;
		ret.emplace_back(x, y);
		x = (-B - sqrt(B*B - 4 * A*C)) / 2 / A;
		y = a * x + b;
		ret.emplace_back(x, y);
	}
	else if (B*B - 4 * A*C >= -EPS) {
		T x = -B / 2 / A;
		T y = a * x + b;
		ret.emplace_back(x, y);
	}
	return ret;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	
	cin >> N >> K;
	vector<long double>x(N);
	vector<long double>y(N);
	vector<long double>z(N);
	for (int i = 0; i < N; i++) {
		cin >> x[i] >> y[i] >> z[i];
	}
	if (K == 1) {
		cout << 0 << endl;
		return 0;
	}
	long double l = 0, r = 10000000;
	long double nx, ny;
	for (int loop = 0; loop < 100; loop++) {
		long double mid = (l + r) / 2;
		bool flag = false;
		for (int i = 0; i < N; i++) {
			nx = x[i], ny = y[i];
			int cnt = 0;
			for (int j = 0; j < N; j++) {
				if (dis(nx, ny, x[j], y[j])*z[j] - EPS <= mid)cnt++;
			}
			if (cnt >= K)flag = true;
			for (int j = i + 1; j < N; j++) {
				for (auto l : CircleCross(make_pair(make_pair(x[i], y[i]), mid / z[i]), make_pair(make_pair(x[j], y[j]), mid / z[j]))) {
					
					cnt = 0;
					for (int k = 0; k < N; k++) {
						if (dis(l.first, l.second, x[k], y[k])*z[k] - EPS <= mid)cnt++;
					}
				//	cout << mid << " " << cnt << endl;
					if (cnt >= K)flag = true;
				}
			}
		}
		if (flag)r = mid;
		else l = mid;
	}
	cout <<setprecision(20)<< l << endl;
	
}

Measured memory_bytes: 256