#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define F first
#define S second
#define pii pair<int, int>
#define eb emplace_back
#define all(v) v.begin(), v.end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep3(i, l, n) for (int i = l; i < (n); ++i)
#define sz(v) (int)v.size()
const int inf = 1e9 + 7;
const ll INF = 1e18;
#define abs(x) (x >= 0 ? x : -(x))
#define lb(v, x) (int)(lower_bound(all(v), x) - v.begin())
#define ub(v, x) (int)(upper_bound(all(v), x) - v.begin())
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<typename T> T pow(T a, int b) { return b ? pow(a * a, b / 2) * (b % 2 ? a : 1) : 1; }
const int mod = 1000000007;
ll modpow(ll a, int b) { return b ? modpow(a * a % mod, b / 2) * (b % 2 ? a : 1) % mod : 1; }
template<class T> ostream& operator<<(ostream& os, const vector<T>& vec) { rep(i, sz(vec)) { if (i) os << " "; os << vec[i]; } return os; }
template<class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.F << " " << p.S; return os; }
template<class T> inline void add(T &a, int b) { a += b; if (a >= mod) a -= mod; }



void solve();

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout << fixed << setprecision(10);
    
    int T;
    // cin >> T;
    T = 1;
    
    while (T--) {
        solve();
    }
}


int n, k;
using t = tuple<double, double, double>;
vector<t> v;

using P = complex<double>;
double dot(P a, P b) { return real(conj(a) * b); }
double cross(P a, P b) { return imag(conj(a) * b); }
const double eps = 1e-8;

double dist_p_p(P a, P b) {
    return sqrt(pow(a.real() - b.real(), 2) + pow(a.imag() - b.imag(), 2));
}
double dist_p_l(P p, P p0, P p1) {
    // ax + by + c = 0
    double x0 = p0.real(), y0 = p0.imag(), x1 = p1.real(), y1 = p1.imag();
    
    double a = y1 - y0;
    double b = x0 - x1;
    double c = y0 * (x1 - x0) - (y1 - y0) * x0;
    
    double d = abs(a * p.real() + b * p.imag() + c) / sqrt(a * a + b * b);
    return d;
}
pair<P, P> inter_c_c(P p, P p2, double r, double r2) {
    double d = dist_p_p(p, p2);
    
    // 中心どうしの角度
    double t = arg(p2 - p);
    // 2 円の交点と p の角度
    // 余弦定理
    double a = acos((r * r + d * d - r2 * r2) / (2 * r * d));
    
    P p3 = P(p.real() + r * cos(t + a), p.imag() + r * sin(t + a));
    P p4 = P(p.real() + r * cos(t - a), p.imag() + r * sin(t - a));
    return make_pair(p3, p4);
}
bool cnt_k(P p, double z) {
    int cnt = 0;
    rep(i, n) {
        double x2, y2, c2;
        tie(x2, y2, c2) = v[i];
        P p2 = P(x2, y2);
        double r2 = z / c2;
        if (dist_p_p(p, p2) < r2 + eps) {
            cnt++;
        }
    }
    if (cnt >= k) return 1;
    return 0;
}
template<typename T>
bool check(T z) {
    /*
     すべての円の交点, 円の中心に関して
     それを含む円が k 個以上ありますか
     */
    // 中心
    rep(i, n) {
        double x, y, c;
        tie(x, y, c) = v[i];
        P p = P(x, y);
        
        if (cnt_k(p, z)) return 1;
    }
    
    // 円の交点
    rep(i, n) {
        double x, y, c;
        tie(x, y, c) = v[i];
        P p = P(x, y);
        double r = z / c;
        
        rep3(j, i + 1, n) {
            // まず交点を持つか
            double x2, y2, c2;
            tie(x2, y2, c2) = v[j];
            P p2 = P(x2, y2);
            double r2 = z / c2;
            
            if (dist_p_p(p, p2) + eps > r + r2) {
                continue;
            }
            pair<P, P> p3 = inter_c_c(p, p2, r, r2);
            rep(l, 2) {
                P p4;
                if (l == 0) p4 = p3.F;
                else p4 = p3.S;
                if (cnt_k(p4, z)) return 1;
            }
        }
    }
    return 0;
}

template<typename T>
void binary_search(T ok, T ng) {
    while (abs(ng - ok) > eps) { // debuged, 1 to eps
        T mid = (ng + ok) / 2;
        (check(mid) ? ok : ng) = mid;
    }
    cout << ok << endl;
}

void solve() {
    cin >> n >> k;
    v.resize(n);
    rep(i, n) {
        double x, y, c;
        cin >> x >> y >> c;
        v[i] = make_tuple(x, y, c);
    }
    binary_search(10000000.0, 0.0);
}




Measured memory_bytes: 512