#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <climits>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <double, double>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no {cout << 0; return;}
#define mkp make_pair
#define mkt make_tuple
#define cerr if(0) cerr

const double eps = 1e-7, INF = 1e9 + 7;

double dist(pi A, pi B) {
    return sqrt((A.F - B.F) * (A.F - B.F) + (A.S - B.S) * (A.S - B.S));
}

tuple <bool, pi, pi> intersect(double x, double y, double r, double A, double B, double C) {
    double d = sqrt(A * A + B * B);
    A /= d; B /= d; C /= d;
    double h = abs(A * x + B * y + C);
    if (h - r > eps || abs(h - r) < eps)
        return make_tuple(0, mkp(0, 0), mkp(0, 0));
    pi P;
    if (A * (x + A * h) + B * (y + B * h) + C <= eps)
        P = { x + A * h, y + B * h };
    else
        P = { x - A * h, y - B * h };
    double s = sqrt(r * r - h * h);
    pi M = {P.F - B * s, P.S + A * s}, N = {P.F + B * s, P.S - A * s};
    return make_tuple(1, M, N);
}

tuple <bool, pi, pi> intersect_circles(double x1, double y1, double r1, double x2, double y2, double r2) {
    double A = 2 * (x1 - x2), B = 2 * (y1 - y2), C = x2 * x2 + y2 * y2 - r2 * r2 - x1 * x1 - y1 * y1 + r1 * r1;
    return intersect(x1, y1, r1, A, B, C);
}

bool good(double val, int k, vector <pi> &p, vector <int> &c) {
    loop(i, p.size()) {
        pi v = p[i];
        int cnt = 0;
        loop(q, p.size())
            if (dist(v, p[q]) * c[q] <= val + eps)
                ++cnt;
        if (cnt >= k)
            return true;
        for (int j = i + 1; j < p.size(); ++j) {
            pi u = p[j];
            double r1 = val / c[i], r2 = val / c[j];
            auto X = intersect_circles(v.F, v.S, r1, u.F, u.S, r2);
            if (!get<0>(X))
                continue;
            pair <pi, pi> P = { get<1>(X), get<2>(X) };
            int ca = 0, cb = 0;
            loop(q, p.size()) {
                pi w = p[q];
                if (dist(P.F, w) * c[q] <= val + eps)
                    ++ca;
                if (dist(P.S, w) * c[q] <= val + eps)
                    ++cb;
            }
            if (ca >= k || cb >= k)
                return true;
        }
    }
    return false;
}

void solve() {
    int n, k;
    cin >> n >> k;
    vector <pi> p(n);
    vector <int> cost(n);
    loop(i, n) {
        cin >> p[i].F >> p[i].S;
        cin >> cost[i];
    }
    double l = 0, r = INF;
    while (r - l > eps) {
        double m = (r + l) / 2;
        if (good(m, k, p, cost))
            r = m;
        else
            l = m;
    }
    cout << fixed << setprecision(7) << (r + l) / 2;
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}


Measured memory_bytes: 3820