#include <bits/stdc++.h>

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<double, double> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

template<typename T>
static inline void chmax(T& ref, const T value) {
	if (ref < value) ref = value;
}

const ll mod = 1000000007;

struct vector2d {
	double x, y;
	vector2d() :x(0), y(0) {}
	vector2d(double x, double y) : x(x), y(y) {}

	static double distanceSquare(const vector2d& v1, const vector2d& v2) {
		double dx = v1.x - v2.x;
		double dy = v1.y - v2.y;
		return dx * dx + dy * dy;
	}

	static double distance(const vector2d& v1, const vector2d& v2) {
		return sqrt(distanceSquare(v1, v2));
	}

	vector2d sub(vector2d p2) const {
		return vector2d(x - p2.x, y - p2.y);
	}

	vector2d add(vector2d p2) const {
		return vector2d(x + p2.x, y + p2.y);
	}

	double distance(vector2d p2) const {
		return sqrt((x - p2.x) * (x - p2.x) + (y - p2.y) * (y - p2.y));
	}

	double norm() const {
		double length = sqrt(x * x + y * y);
		return length;
	}

	vector2d normal() const {
		double length = norm();
		return vector2d(x / length, y / length);
	}

	vector2d scale(double s) const {
		return vector2d(x * s, y * s);
	}

	vector2d operator+(const vector2d& p) const { return vector2d(x + p.x, y + p.y); }
	vector2d operator-(const vector2d& p) const { return vector2d(x - p.x, y - p.y); }
	vector2d operator*(double a) const { return vector2d(x * a, y * a); }
	vector2d Rot90() const { return { -y, x }; }
};

typedef vector2d V;

struct circle2d {
	vector2d center;
	double radius;
	
	circle2d(){}

	circle2d(double x, double y, double r) {
		center = { x,y };
		radius = r;
	}

	static constexpr double eps = 1e-9;
	static bool equal(double a, double b) { return abs(a - b) < eps; }

	std::vector<vector2d> Intersections(const circle2d& c) const {
		V v = c.center - center;
		double l = v.norm();
		if (equal(l, 0)) return {};
		if (equal(l + radius + c.radius, max({ l,radius,c.radius }) * 2)) {
			return { center + v * (radius / l) };
		}
		if (l + radius + c.radius < max({ l,radius,c.radius }) * 2) return {};
		double x = -(c.radius * c.radius - l * l - radius * radius) / (2 * l);
		double y = sqrt(radius * radius - x * x);
		V mid = center + v * (x / l);
		v = v.Rot90();
		return { mid + v * (y / l), mid - v * (y / l) };
	}
};

int main() {
	ll n, k;
	cin >> n >> k;
	vector<circle2d> xs(n);
	rep(i, n) {
		cin >> xs[i].center.x >> xs[i].center.y >> xs[i].radius;
	}
	if (k == 1) {
		cout << 0 << endl;
		return 0;
	}
	double left = 0; double right = 100*8000;
	double m;
	while(right- left > 1e-8) {
		m = (left + right) / 2;
		vector<V> ps;
		rep(i, n) ps.emplace_back(xs[i].center);
		rep(i, n)rep(j, i) {
			circle2d a = xs[i], b = xs[j];
			a.radius = m / a.radius;
			b.radius = m / b.radius;
			auto tmp = a.Intersections(b);
			ps.insert(ps.end(), tmp.begin(), tmp.end());
		}		
		bool ok = false;
		for (auto p : ps) {
			int count = 0;
			count = 0;
			//cout << p.x << "," << p.y << endl;
			for (int i = 0; i < n; i++) {
				auto nc = xs[i];
				nc.radius = m / nc.radius;
				auto diff = p - nc.center;
				if (diff.norm() <= nc.radius + 1e-10) {
					count++;
				}
			}
			if (count >= k) {
				ok = true;
				break;
			}
		}

		//cout << m << "," << count << endl;
		if (ok) {
			right = m;
		}
		else {
			left = m;
		}
	}
	cout << fixed << setprecision(10);
	cout << right << endl;
	return 0;
}


Measured memory_bytes: 3916