#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <algorithm>
#include <numeric>
#include <set>
#include <iomanip>



struct Point {
	double x, y;
	double distance(const Point& that) const;
};
struct Angle {
	double sin, cos;
	Angle operator-()const {
		return Angle{ -sin, cos };
	}
};
struct Vector {
	double dx, dy;
	Vector rotate(const Angle angle) const {
		return Vector{ dx * angle.cos - dy * angle.sin, dy * angle.cos + dx * angle.sin };
	}
	double length() const {
		return std::sqrt(dx * dx + dy * dy);
	}
	Vector change_length(const double new_length) const {
		const auto current = length();
		return Vector{ dx / current * new_length, dy / current * new_length };
	}
};
Vector operator-(const Point a, const Point b);
Point operator+(const Point a, const Vector v);
Vector operator-(const Point a, const Point b) {
	return Vector{ a.x - b.x, a.y - b.y };
}
Point operator+(const Point a, const Vector v)
{
	return Point{ a.x + v.dx, a.y + v.dy };
}
struct Circle {
	Point center;
	double radius;

};
Angle angle_of(double opposite, double a, double b) {
	double cos = (a * a + b * b - opposite * opposite) / (2 * a * b);
	return Angle{ std::sqrt(1 - cos * cos), cos };
}

bool has_intersection(const Circle& a, const Circle& b) {
	return a.center.distance(b.center) <= a.radius + b.radius;
}
bool is_contains(const Circle& outer, const Circle& inner) {
	if (outer.radius < inner.radius) return false;
	return outer.center.distance(inner.center) + inner.radius <= outer.radius;
}
std::vector<Point> cross_point(const Circle a, const Circle b) {
	if (!has_intersection) return {};
	if (is_contains(a, b)) return { b.center };
	if (is_contains(b, a)) return { a.center };
	const auto angle = angle_of(b.radius, a.radius, a.center.distance(b.center));
	const auto vec = (b.center - a.center).change_length(a.radius);
	return { a.center + vec.rotate(angle), a.center + vec.rotate(-angle) };
}
int count_circle(const Point target, const std::vector<Circle>& circles) {
	int count = 0;
	for (const auto c : circles) {
		if (c.center.distance(target) <= c.radius + 1e-6) {
			++count;
		}
	}
	return count;
}
std::vector<Point> cross_points(const std::vector<Circle>& circles) {
	std::vector<Point> points;
	for (auto i = 0; i < circles.size(); ++i) {
		for (auto j = 0; j < circles.size(); ++j) {
			for (const auto cp : cross_point(circles[i], circles[j])) {
				points.push_back(cp);
			}
		}
	}
	return points;
}
struct Meat {
	Point position;
	double headness;
};
std::vector<Circle> to_circles(double time, const std::vector<Meat>& meats) {
	std::vector<Circle> result; result.reserve(meats.size());
	for (const auto& m : meats) {
		result.push_back(Circle{ m.position, time / m.headness });
	}
	return result;
}
bool can_make(int count, double time, const std::vector<Meat>& meat) {
	const auto circles = to_circles(time, meat);
	for (const auto cp : cross_points(circles)) {
		if (count_circle(cp, circles) >= count) return true;
	}
	return false;
}
int main() {
	int n, k; std::cin >> n >> k;
	std::vector<Meat> meats(n);
	for (auto& m : meats) std::cin >> m.position.x >> m.position.y >> m.headness;
	double min = 0, max = 10000000;
	for (auto i = 0; i < 60; ++i) {
		const auto mid = (min + max) / 2;
		if (can_make(k, mid, meats)) {
			max = mid;
		}
		else {
			min = mid;
		}
	}
	std::cout << std::setprecision(15) << std::fixed << max << std::endl;
}

double Point::distance(const Point& that) const {
	return ((*this) - that).length();
}

Measured memory_bytes: 888