#include <stdio.h>
#include <math.h>
struct point {
	double x;
	double y;
};
point naibun(point p1, point p2, double t1, double t2) {
	double t = t1 + t2;
	t1 /= t;
	t2 /= t;
	point p;
	p.x = p1.x * t2 + p2.x * t1;
	p.y = p1.y * t2 + p2.y * t1;
	return p;
}
struct line {
	//ax+by+c=0
	//a*a+b*b=1
	double a;
	double b;
	double c;
};
struct circle {
	point center;
	double r;
};
double distance(point p1, point p2) {
	return sqrt((p1.x - p2.x) * (p1.x - p2.x) + (p1.y - p2.y) * (p1.y - p2.y));
}
line makeline(point p1, point p2) {
	line l;
	l.a = p1.y - p2.y;
	l.b = p2.x - p1.x;
	l.c = p1.x * p2.y - p2.x * p1.y;
	double t;
	t = sqrt(l.a * l.a + l.b * l.b);
	l.a /= t;
	l.b /= t;
	l.c /= t;
	return l;
}
circle makecircle(point p, double r) {
	circle c;
	c.center = p;
	c.r = r;
	return c;
}
point llintersect(line l1, line l2) {
	point p;
	p.x = (l1.b * l2.c - l2.b * l1.c) / (l1.a * l2.b - l2.a * l1.b);
	p.y = (l1.a * l2.c - l2.a * l1.c) / (l2.a * l1.b - l1.a * l2.b);
	return p;
}
line perpendicular(point p, line l1) {
	line l;
	l.a = l1.b;
	l.b = -l1.a;
	l.c = l1.a * p.y - l1.b * p.x;
	double t;
	t = sqrt(l.a * l.a + l.b * l.b);
	l.a /= t;
	l.b /= t;
	l.c /= t;
	return l;
}
point lcintersectA(line l, circle c) {
	point p;
	line l1;
	double d;
	l1 = perpendicular(c.center, l);
	p = llintersect(l, l1);
	d = distance(c.center, p);
	d = sqrt(c.r * c.r - d * d);
	p.x += l1.a * d;
	p.y += l1.b * d;
	return p;
}
point lcintersectB(line l, circle c) {
	point p;
	line l1;
	double d;
	l1 = perpendicular(c.center, l);
	p = llintersect(l, l1);
	d = distance(c.center, p);
	d = sqrt(c.r * c.r - d * d);
	p.x -= l1.a * d;
	p.y -= l1.b * d;
	return p;
}
line ccroot(circle c1, circle c2) {
	line l;
	l.a = -2 * c1.center.x + 2 * c2.center.x;
	l.b = -2 * c1.center.y + 2 * c2.center.y;
	l.c = c1.center.x * c1.center.x + c1.center.y * c1.center.y - c1.r * c1.r;
	l.c -= c2.center.x * c2.center.x + c2.center.y * c2.center.y - c2.r * c2.r;
	double t;
	t = sqrt(l.a * l.a + l.b * l.b);
	l.a /= t;
	l.b /= t;
	l.c /= t;
	return l;
}
point ccintersectA(circle c1, circle c2) {
	line l;
	l = ccroot(c1, c2);
	return lcintersectA(l, c1);
}
point ccintersectB(circle c1, circle c2) {
	line l;
	l = ccroot(c1, c2);
	return lcintersectB(l, c1);
}
int main() {
	int n, k;
	scanf("%d%d", &n, &k);
	if (k == 1) {
		printf("0\n");
		return 0;
	}
	point p[60];
	point q, r, m;
	line l[60][60];
	circle o[60][60];
	double t;
	int e;
	double ans;
	double c[60];
	ans = 2000 * 100;
	for (int i = 0; i < n; i++) {
		scanf("%lf%lf", &p[i].x, &p[i].y);
		scanf("%lf", c + i);
		c[i] = 1 / c[i];
	}
	for (int i1 = 0; i1 < n; i1++) {
		for (int i2 = i1 + 1; i2 < n; i2++) {
			q = naibun(p[i1], p[i2], c[i1], c[i2]);
			t = (1 / c[i1]) * distance(p[i1], q);
			if (t < ans) {
				e = 0;
				t += 0.0000001;
				for (int i4 = 0; i4 < n; i4++) {
					if (distance(p[i4], q) <= t * c[i4])e++;
				}
				if (e >= k)ans = t - 0.0000001;
			}
			if (c[i1] != c[i2]) {
				q = naibun(p[i1], p[i2], -c[i1], c[i2]);
				t = (1 / c[i1]) * distance(p[i1], q);
				if (t < ans) {
					e = 0;
					t += 0.0000001;
					for (int i4 = 0; i4 < n; i4++) {
						if (distance(p[i4], q) <= t * c[i4])e++;
					}
					if (e >= k)ans = t - 0.0000001;
				}
			}
		}
	}
	for (int i = 0; i < n; i++) {
		for (int j = i + 1; j < n; j++) {
			if (c[i] == c[j]) {
				q = naibun(p[i], p[j], 1, 1);
				l[i][j] = perpendicular(q, makeline(p[i], p[j]));
			}
			else {
				q = naibun(p[i], p[j], c[i], c[j]);
				r = naibun(p[i], p[j], -c[i], c[j]);
				m = naibun(q, r, 1, 1);
				o[i][j] = makecircle(m, distance(m, q));
			}
		}
	}
	for (int i1 = 0; i1 < n; i1++) {
		for (int i2 = i1 + 1; i2 < n; i2++) {
			for (int i3 = i2 + 1; i3 < n; i3++) {
				if (c[i1] == c[i2] && c[i1] == c[i3]) {
					if (l[i1][i2].a * l[i1][i3].b != l[i1][i2].b * l[i1][i3].a) {
						q = llintersect(l[i1][i2], l[i1][i3]);
						t = (1 / c[i1]) * distance(p[i1], q);
						if (t < ans) {
							e = 0;
							t += 0.0000001;
							for (int i4 = 0; i4 < n; i4++) {
								if (distance(p[i4], q) <= t * c[i4])e++;
							}
							if (e >= k)ans = t - 0.0000001;
						}
					}
				}
				if (c[i1] == c[i2] && c[i1] != c[i3]) {
					if (fabs(o[i1][i3].center.x * l[i1][i2].a + o[i1][i3].center.y * l[i1][i2].b + l[i1][i2].c) < o[i1][i3].r) {
						q = lcintersectA(l[i1][i2], o[i1][i3]);
						r = lcintersectB(l[i1][i2], o[i1][i3]);
						t = (1 / c[i1]) * distance(p[i1], q);
						if ((1 / c[i1]) * distance(p[i1], r) < t) {
							q = r;
							t = (1 / c[i1]) * distance(p[i1], r);
						}
						if (t < ans) {
							e = 0;
							t += 0.0000001;
							for (int i4 = 0; i4 < n; i4++) {
								if (distance(p[i4], q) <= t * c[i4])e++;
							}
							if (e >= k)ans = t - 0.0000001;
						}
					}
				}
				if (c[i1] != c[i2] && c[i1] == c[i3]) {
					if (fabs(o[i1][i2].center.x * l[i1][i3].a + o[i1][i2].center.y * l[i1][i3].b + l[i1][i3].c) < o[i1][i2].r) {
						q = lcintersectA(l[i1][i3], o[i1][i2]);
						r = lcintersectB(l[i1][i3], o[i1][i2]);
						t = (1 / c[i1]) * distance(p[i1], q);
						if ((1 / c[i1]) * distance(p[i1], r) < t) {
							q = r;
							t = (1 / c[i1]) * distance(p[i1], r);
						}
						if (t < ans) {
							e = 0;
							t += 0.0000001;
							for (int i4 = 0; i4 < n; i4++) {
								if (distance(p[i4], q) <= t * c[i4])e++;
							}
							if (e >= k)ans = t - 0.0000001;
						}
					}
				}
				if (c[i1] != c[i2] && c[i1] != c[i3]) {
					t = distance(o[i1][i2].center, o[i1][i3].center);
					if (t < o[i1][i2].r + o[i1][i3].r && fabs(o[i1][i2].r - o[i1][i3].r) < t) {
						q = ccintersectA(o[i1][i3], o[i1][i2]);
						r = ccintersectB(o[i1][i3], o[i1][i2]);
						t = (1 / c[i1]) * distance(p[i1], q);
						if ((1 / c[i1]) * distance(p[i1], r) < t) {
							q = r;
							t = (1 / c[i1]) * distance(p[i1], r);
						}
						if (t < ans) {
							e = 0;
							t += 0.0000001;
							for (int i4 = 0; i4 < n; i4++) {
								if (distance(p[i4], q) <= t * c[i4])e++;
							}
							if (e >= k)ans = t - 0.0000001;
						}
					}
				}
			}
		}
	}
	printf("%.10lf\n", ans);
}

Measured memory_bytes: 384