#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <cmath>

using namespace std;

#define LL long long

const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};

#define eps 1e-10

#define PI 3.1415926535897932384626433

LL mod(LL x, LL md) {
	return ((x % md) + md) % md;
}

class Mint {
public:
	static LL md;
	LL x;
	Mint(LL _x) {
		x = mod(_x, md);
	}
	Mint(const Mint &y) {
		x = mod(y.x, md);
	}
};

void MintMyExgcd(LL a, LL b, LL &x, LL &y) {
	// solve equation ax + by = 1 (mod m)
	LL md = Mint::md;
	if (b == 0) {
		y = 0;
		x = 1;
		return ;
	}
	MintMyExgcd(b, a % b, x, y);
	LL t = y;
	y = mod(x - (a / b) * y, md);
	x = t;
}

LL MintNY(LL x) {
	if (x == 0) {
		return 1;
	}
	LL md = Mint::md;
	LL a, b;
	MintMyExgcd(x, md, a, b);
	while (a < 0) {
		a += md;
	}
	return a;
}

/* LL gcd(LL a, LL b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a % b);
} */

Mint operator+(Mint a, Mint b) {
	return Mint(mod(a.x + b.x, Mint::md));
}
Mint operator-(Mint a, Mint b) {
	return Mint(mod(a.x - b.x, Mint::md));
}
Mint operator*(Mint a, Mint b) {
	return Mint(mod(a.x * b.x, Mint::md));
}
Mint operator/(Mint a, Mint b) {
	Mint c = Mint(MintNY(b.x));
	return Mint(mod(a.x * c.x, Mint::md));
}

Mint operator-(Mint a) {
	return Mint(-a.x);
}
bool operator==(Mint a, Mint b) {
	return a.x == b.x;
}
bool operator!=(Mint a, Mint b) {
	return a.x != b.x;
}
bool operator>(Mint a, Mint b) {
	return a.x > b.x;
}
bool operator<(Mint a, Mint b) {
	return a.x < b.x;
}
bool operator>=(Mint a, Mint b) {
	return a.x >= b.x;
}
bool operator<=(Mint a, Mint b) {
	return a.x <= b.x;
}

void operator+=(Mint &a, Mint b) {
	a = a + b;
}
void operator-=(Mint &a, Mint b) {
	a = a - b;
}
void operator*=(Mint &a, Mint b) {
	a = a * b;
}
void operator/=(Mint &a, Mint b) {
	a = a / b;
}

ostream& operator<<(ostream &out, Mint a) {
	out << a.x;
	return out;
}

istream& operator>>(istream &in, Mint &a) {
	in >> a.x;
	return in;
}

Mint factorial(LL n) {
	if (n == 0) {
		return Mint(1);
	}
	Mint res = 1;
	for (LL i = 1; i <= n; ++i) {
		res *= i;
	}
	return res;
}
Mint multiRange(LL s, LL t) {
	Mint res = 1;
	for (LL i = s; i <= t; ++i) {
		res *= i;
	}
	return res;
}

Mint getC(LL n, LL k) {
	if (n - k < k) {
		return getC(n, n - k);
	}
	return multiRange(n - k + 1, n) / factorial(k);
}

Mint getA(LL n, LL k) {
	return multiRange(n - k + 1, n);
}

Mint countNonNegativeDivision(LL n, LL k) {
	return getC(n + k - 1, k - 1);
}
Mint countPositiveDivision(LL n, LL k) {
	if (n < k) {
		return 0;
	}
	if (k <= 0) {
		return 0;
	}
	return getC(n - 1, k - 1);
}
Mint quickMod(Mint a, LL b) {
	Mint res = 1;
	while (b > 0) {
		if (b % 2) {
			res *= a;
		}
		a *= a;
		b /= 2;
	}
	return res;
}

LL Mint::md = 1000000007;

int n, k;
int *x, *y, *c;
double res;

double msqr(double x) {
	return x * x;
}

double distance(double x1, double y1, double x2, double y2) {
	return sqrt(msqr(x1 - x2) + msqr(y1 - y2));
}

double getTime(double x0, double y0) {
	vector<double> tm;
	tm.clear();
	for (int i = 0; i < n; ++i) {
		tm.push_back(c[i] * distance(x0, y0, x[i], y[i]));
	}
	sort(tm.begin(), tm.end());
	return tm[k - 1];
}
bool checkTime(double x0, double y0, double tm) {
	int count = 0;
	for (int i = 0; i < n; ++i) {
		double tmi = c[i] * distance(x0, y0, x[i], y[i]);
		if (tmi < tm) {
			++count;
		}
	}
	return (count >= k);
}
vector<double> r;
bool checkPoint(double x0, double y0) {
	int res = 0;
	for (int i = 0; i < n; ++i) {
		if (distance(x0, y0, x[i], y[i]) < r[i] + eps) {
			++res;
		}
	}
	return (res >= k);
}


vector<vector<double> > getCross(int a, int b) {
	// cross between x[a], y[a], r[a]
	// and x[b], y[b], r[b]
	double xa = x[a], ya = y[a], ra = r[a];
	double xb = x[b], yb = y[b], rb = r[b];
	if (ra < rb) {
		swap(xa, xb);
		swap(ya, yb);
		swap(ra, rb);
	}
	double ds = distance(xa, ya, xb, yb);
	vector<vector<double> > res;
	res.clear();
	if (ds > ra + rb) {
		return res;
	}
	if (ds < ra - rb) {
		return res;
	}
	double cosA = (msqr(ra) + msqr(ds) - msqr(rb)) / (2 * ra * ds);
	double sinA = sqrt(1.0 - cosA * cosA);
	double dx = xb - xa, dy = yb - ya;
	double cj = ds * ra * sinA;
	double theta;
	if (abs(dx) < eps) {
		if (dy > 0) {
			theta = 0.5 * PI;
		}
		else {
			theta = -0.5 * PI;
		}
	}
	else {
		theta = atan(dy / dx);
		if (dx < 0.0) {
			theta += (1.0 * PI);
		}
	}
	double thetaA = asin(sinA);
	double theta1 = theta + thetaA, theta2 = theta - thetaA;

	double xx, yy;
	vector<double> p1;
	xx = xa + ra * cos(theta1); yy = ya + ra * sin(theta1);
	double rra = distance(xx, yy, xa, ya);
	double rrb = distance(xx, yy, xb, yb);
	// printf("ra = %.6lf, rb = %.6lf, ra should be %.6lf, rb should be %.6lf\n", rra, rrb, ra, rb);
	// printf("xx = %.6lf, yy = %.6lf\n", xx, yy);
	p1.push_back(xx); p1.push_back(yy);
	res.push_back(p1);

	vector<double> p2;
	xx = xa + ra * cos(theta2); yy = ya + ra * sin(theta2);
	rra = distance(xx, yy, xa, ya);
	rrb = distance(xx, yy, xb, yb);
	// printf("ra = %.6lf, rb = %.6lf, ra should be %.6lf, rb should be %.6lf\n", rra, rrb, ra, rb);
	// printf("xx = %.6lf, yy = %.6lf\n", xx, yy);
	p2.push_back(xx); p2.push_back(yy);
	res.push_back(p2);

	return res;
	// length ra, have sinA with (dx, dy)

	// (x, y):
	// |(x, y)| == ra
	// |x * dy - y * dx| = (ds * ra * sinA)

}

bool check(double tm) {
	// printf("checking %.10lf\n", tm);
	r.clear();
	for (int i = 0; i < n; ++i) {
		r.push_back(tm / c[i]);
		// printf("r[%d] = %.6lf\n", i, r[i]);
	}
	vector<vector<double> > xy;

	for (int i = 0; i < n; ++i) {
		for (int j = i + 1; j < n; ++j) {
			xy = getCross(i, j);
			for (int k = 0; k < xy.size(); ++k) {
				if (checkPoint(xy[k][0], xy[k][1])) {
					return true;
				}
			}
		}
	}
	for (int i = 0; i < n; ++i) {
		if (checkPoint(x[i], y[i])) {
			return true;
		}
	}
	return false;
}

int main() {
	cin >> n >> k;
	x = new int[n];
	y = new int[n];
	c = new int[n];

	for (int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i] >> c[i];
	}

	double lft = 0.0, rgt = 1000000.0;
	double mid;
	// double eps = 1e-10;
	while ((rgt - lft) / rgt > 1e-8) {
		mid = (lft + rgt) * 0.5;
		if (check(mid)) {
			rgt = mid;
		}
		else {
			lft = mid;
		}
	}
	res = mid; 
	printf("%.12lf\n", res);
	// cout << check(2.45) << endl;
	/*for (int i = 0; i < n; ++i) {
		cout << r[i] << ' ';
	}
	cout << endl;*/
	return 0;
}

Measured memory_bytes: 256