#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define int long long
#define ll long long
#define mod (int)998244353
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = 1e-9;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline int gcd(int a, int b) {
	while (b) {
		int c = a;
		a = b; b = c % b;
	}
	return a;
}
inline int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
bool isprime(int n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
int mypow(int a, int b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	int memo = mypow(a, b >> 1);
	return memo * memo;
}
int modpow(int a, int b, int m = mod) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	int memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
int n, k;
double x[60], y[60], c[60], r[60];
signed main() {
	cin >> n >> k;
	rep(i, n)cin >> x[i] >> y[i] >> c[i];
	double mi = 0, ma = 1000000;
	rep(z, 100) {
		double md = (mi + ma) / 2;
		rep(i, n)r[i] = md / c[i];
		rep(i, n) {
			for (int j = i + 1; j < n; j++) {
				if (hypot(x[i] - x[j], y[i] - y[j]) <= r[i] - r[j] + eps || hypot(x[i] - x[j], y[i] - y[j]) >= r[i] + r[j] + eps)continue;
				double nx = x[j] - x[i], ny = y[j] - y[i];
				double a = (nx * nx + ny * ny + r[i] * r[i] - r[j] * r[j]) / 2;
				double mx, my;
				int cnt = 0;
				mx = (a * nx + ny * (sqrt((nx * nx + ny * ny) * r[i] * r[i] - a * a))) / (nx * nx + ny * ny) + x[i];
				my = (a * ny - nx * (sqrt((nx * nx + ny * ny) * r[i] * r[i] - a * a))) / (nx * nx + ny * ny) + y[i];
				rep(k, n) {
					if (i == k || j == k)continue;
					if (hypot(mx - x[k], my - y[k]) <= r[k] + eps)cnt++;
				}
				if (cnt >= k - 2) {
					ma = md;
					goto end;
				}
				mx = (a * nx - ny * (sqrt((nx * nx + ny * ny) * r[i] * r[i] - a * a))) / (nx * nx + ny * ny) + x[i];
				my = (a * ny + nx * (sqrt((nx * nx + ny * ny) * r[i] * r[i] - a * a))) / (nx * nx + ny * ny) + y[i];
				cnt = 0;
				rep(k, n) {
					if (i == k || j == k)continue;
					if (hypot(mx - x[k], my - y[k]) <= r[k] + eps)cnt++;
				}
				if (cnt >= k - 2) {
					ma = md;
					goto end;
				}
			}
			double mx, my;
			int cnt = 0;
			mx = x[i];
			my = y[i];
			rep(k, n) {
				if (hypot(mx - x[k], my - y[k]) <= r[k] + eps)cnt++;
			}
			if (cnt >= k) {
				ma = md;
				goto end;
			}
		}
		mi = md;
	end:;
	}
	printf("%.12lf\n", mi);
	return 0;
}

Measured memory_bytes: 256