#include "bits/stdc++.h"
using namespace std;
typedef long long li;

typedef double Real;
typedef complex<Real> Point;

Real cos(Real a, Real b, Real c) {
    return (b * b + c * c - a * a) / (2 * b * c);
}
Real acos2(Real a, Real b, Real c) {
    return acos(cos(a, b, c));
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    li n, k;
    cin >> n >> k;

    vector<Point> meats;
    vector<Real> weights;
    for (int i = 0; i < n; ++i) {
        Real x, y, c;
        cin >> x >> y >> c;
        meats.emplace_back(x, y);
        weights.emplace_back(c);
    }

    auto find_time = [&](const Point center) {
        vector<Real> times;
        for (int i = 0; i < n; ++i) {
            times.push_back(abs(center - meats[i]) * weights[i]);
        }
        sort(times.begin(), times.end());
        return times[k - 1];
    };

    Real ans = 1e300;
    // n = 1
    for (int i = 0; i < n; ++i) {
        ans = min(ans, find_time(meats[i]));
    }

    // n = 2
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < i; ++j) {
            Point center = (weights[i] * meats[i] + weights[j] * meats[j]) / (weights[i] + weights[j]);
            ans = min(ans, find_time(center));
        }
    }

    // n = 3
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < i; ++j) {
            for (int k = 0; k < j; ++k) {
                Point vdij = meats[j] - meats[i];
                Point vdik = meats[k] - meats[i];
                if (abs(vdij.real() * vdik.imag() - vdij.imag() * vdik.real()) == 0.) {
                    // colinear
                    continue;
                }

                Real p = 0, q = 1e10;
                Real dij = abs(meats[i] - meats[j]);
                Real djk = abs(meats[j] - meats[k]);
                Real dki = abs(meats[k] - meats[i]);

                for (int _it = 0; _it < 100; ++_it) {
                    Real m = (p + q) / 2;
                    Real di = m / weights[i];
                    Real dj = m / weights[j];
                    Real dk = m / weights[k];

                    bool exceed;
                    if (di + dj < dij) {
                        exceed = true;
                    } else if (di + dij < dj) {
                        exceed = false;
                    } else if (dj + dij < di) {
                        exceed = false;
                    } else if (dj + dk < djk) {
                        exceed = true;
                    } else if (dj + djk < dk) {
                        exceed = false;
                    } else if (dk + djk < dj) {
                        exceed = false;
                    } else if (dk + di < dki) {
                        exceed = true;
                    } else if (dk + dki < di) {
                        exceed = false;
                    } else if (di + dki < dk) {
                        exceed = false;
                    } else {
                        Real argij = acos2(dij, di, dj);
                        Real argjk = acos2(djk, dj, dk);
                        Real argki = acos2(dki, dk, di);

                        exceed = argij + argjk + argki > 2 * M_PI;
                    }
                    if (exceed) {
                        p = m;
                    } else {
                        q = m;
                    }

                }
                Real time = (p + q) / 2;
                Real di = time / weights[i];
                Real dj = time / weights[j];
                Real dk = time / weights[k];
                Point vij = (meats[j] - meats[i]) / dij;
                if (cos(dj, di, dij) > 1) {
                    continue;
                } else if (cos(dj, di, dij) < -1) {
                    continue;
                }


                Point vic1 = vij * polar((Real) 1.,  acos2(dj, di, dij));
                Point vic2 = vij * polar((Real) 1., -acos2(dj, di, dij));
                Point center1 = meats[i] + vic1 * di;
                Point center2 = meats[i] + vic2 * di;

                Real dck1 = abs(dk - abs(center1 - meats[k]));
                Real dck2 = abs(dk - abs(center2 - meats[k]));
                if (dck1 < dck2) {
                    ans = min(ans, find_time(center1));
                } else {
                    ans = min(ans, find_time(center2));
                }
            }
        }
    }

    cout.precision(12);
    cout << fixed << ans << endl;
    return 0;
}

Measured memory_bytes: 256