#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

struct Circle {
    double x, y, r;
};
vector<pair<double, double>> CrossPointsofCircles(Circle c1, Circle c2) {
    double x1, y1, r1, x2, y2, r2;
    x1 = c1.x, y1 = c1.y, r1 = c1.r;
    x2 = c2.x, y2 = c2.y, r2 = c2.r;
    vector<pair<double, double>> ret;
    if ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) > (r1 + r2) * (r1 + r2))
        return ret;
    if ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) < (r1 - r2) * (r1 - r2))
        return ret;
    double a = 2 * (x1 - x2), b = 2 * (y1 - y2),
           c = -x1 * x1 - y1 * y1 + x2 * x2 + y2 * y2 + r1 * r1 - r2 * r2;

    double d = a * x1 + b * y1 + c;
    double x, y;
    x = (-a * d + b * sqrt((a * a + b * b) * r1 * r1 - d * d)) /
            (a * a + b * b) +
        x1;
    y = (-b * d - a * sqrt((a * a + b * b) * r1 * r1 - d * d)) /
            (a * a + b * b) +
        y1;
    ret.emplace_back(x, y);
    x = (-a * d - b * sqrt((a * a + b * b) * r1 * r1 - d * d)) /
            (a * a + b * b) +
        x1;
    y = (-b * d + a * sqrt((a * a + b * b) * r1 * r1 - d * d)) /
            (a * a + b * b) +
        y1;
    ret.emplace_back(x, y);
    sort(all(ret));
    return ret;
}
int main() {
    cout << fixed << setprecision(20);
    int n, k;
    cin >> n >> k;
    vector<double> x(n), y(n), c(n);
    rep(i, n) cin >> x[i] >> y[i] >> c[i];
    double ok = INF, ng = 0, mid;
    rep(_, 1000) {
        mid = (ok + ng) / 2;

        vector<double> px, py;
        rep(i, n) {
            px.push_back(x[i]);
            py.push_back(y[i]);
        }

        int now = 0;
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                Circle c1 = {x[i], y[i], mid / c[i]};
                Circle c2 = {x[j], y[j], mid / c[j]};
                auto v = CrossPointsofCircles(c1, c2);
                for (auto p : v) {
                    px.push_back(p.first);
                    py.push_back(p.second);
                }
            }
        }
        int MAX = 0;
        for (int i = 0; i < sz(px); i++) {
            int now = 0;
            for (int j = 0; j < n; j++) {
                double rj = mid / c[j];
                if ((px[i] - x[j]) * (px[i] - x[j]) +
                        (py[i] - y[j]) * (py[i] - y[j]) <
                    rj * rj + 0.00001)
                    now++;
            }
            chmax(MAX, now);
        }
        (MAX >= k ? ok : ng) = mid;
    }
    cout << fixed << setprecision(20) << ok << endl;
}


Measured memory_bytes: 256