#include <bits/stdc++.h>
using namespace std;
const int maxn = 100;
const double eps = 1e-7;
struct Point
{
	double x, y, c, r;
}p[maxn];
vector<Point> inter;
int n, k;
bool double_equals(const double & a, const double & b) { return fabs(a - b) < eps;}
double sqr(const double & x) { return x * x;}
double getdissqr(const Point & a, const Point & b)
{
	return sqr(a.x - b.x) + sqr(a.y - b.y);
}
double getdis(const Point & a, const Point & b)
{
	return sqrt(sqr(a.x - b.x) + sqr(a.y - b.y));
}
void getinter(const Point & A, const Point & B)
{
	double d, a, b, c, p, q, r;
    double cos_value[2], sin_value[2];
    Point points[2];
    if (double_equals(A.x, B.x)
        && double_equals(A.y, B.y)
        && double_equals(A.r, B.r)) {
        return;
    }
 
    d = getdis(A, B);
    if (d > A.r + B.r || d < fabs(A.r - B.r)) return;
 
    a = 2.0 * A.r * (A.x - B.x);
    b = 2.0 * A.r * (A.y - B.y);
    c = B.r * B.r - A.r * A.r
        - getdissqr(A, B);
    p = a * a + b * b;
    q = -2.0 * a * c;
    if (double_equals(d, A.r + B.r)
        || double_equals(d, fabs(A.r - B.r))) {
        cos_value[0] = min(1.0, -q / p / 2.0);
        sin_value[0] = sqrt(1 - cos_value[0] * cos_value[0]);
 
        points[0].x = A.r * cos_value[0] + A.x;
        points[0].y = A.r * sin_value[0] + A.y;
 
        if (!double_equals(getdissqr(points[0], B),
                           B.r * B.r)) {
            points[0].y = A.y - A.r * sin_value[0];
        }
        inter.push_back(points[0]);
        return;
    }

    r = c * c - b * b;
    cos_value[0] = min(1.0, (sqrt(q * q - 4.0 * p * r) - q) / p / 2.0);
    cos_value[1] = min(1.0, (-sqrt(q * q - 4.0 * p * r) - q) / p / 2.0);
    sin_value[0] = sqrt(1 - cos_value[0] * cos_value[0]);
    sin_value[1] = sqrt(1 - cos_value[1] * cos_value[1]);
 
    points[0].x = A.r * cos_value[0] + A.x;
    points[1].x = A.r * cos_value[1] + A.x;
    points[0].y = A.r * sin_value[0] + A.y;
    points[1].y = A.r * sin_value[1] + A.y;
 
    if (!double_equals(getdissqr(points[0], B),
                       B.r * B.r)) {
        points[0].y = A.y - A.r * sin_value[0];
    }
    if (!double_equals(getdissqr(points[1], B),
                       B.r * B.r)) {
        points[1].y = A.y - A.r * sin_value[1];
    }
    if (double_equals(points[0].y, points[1].y)
        && double_equals(points[0].x, points[1].x)) {
        if (points[0].y > 0) {
            points[1].y = -points[1].y;
        } else {
            points[0].y = -points[0].y;
        }
    }
    inter.push_back(points[0]);
    inter.push_back(points[1]);
    return;
} 	
bool solve(const Point & v)
{
	int tot = 0;
	for(int i = 1; i <= n; ++i)
		if(getdis(v, p[i]) <= p[i].r + eps)
			++tot;
	return tot >= k;
}
bool check(double x)
{
	for(int i = 1; i <= n; ++i) p[i].r = x / p[i].c;
	inter.clear();
	for(int i = 1; i <= n; ++i)
		for(int j = i + 1; j <= n; ++j)
			getinter(p[i], p[j]);
	for(int i = 1; i <= n; ++i)
		inter.push_back(p[i]);
	for(auto v : inter)
	{
		if(solve(v))
			return true;
	}
	return false;
}
int main()
{
	cin >> n >> k;
	for(int i = 1; i <= n; ++i)
		cin >> p[i].x >> p[i].y >> p[i].c;
	double l = 0, r = 2e5;
	while(r - l >= eps)
	{
		double mid = (l + r) / 2;
		if(check(mid)) r = mid;
		else l = mid;
	}
	printf("%.10f\n", l);
	return 0;
}
/*
2 2
0 0 1
1 0 1
*/
		

Measured memory_bytes: 384