#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 Point {
    double x, y;
};
int main() {
    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++) {
                double x1, y1, r1, x2, y2, r2;
                x1 = x[i], y1 = y[i], r1 = mid / c[i];
                x2 = x[j], y2 = y[j], r2 = mid / c[j];

                if ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + 0.0000001 >
                    (r1 + r2) * (r1 + r2))
                    continue;
                if ((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) - 0.0000001 <
                    (r1 - r2) * (r1 - r2))
                    continue;

                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;
                px.push_back(X);
                py.push_back(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;
                px.push_back(X);
                py.push_back(Y);
            }
        }
        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