// May this submission get accepted
#include <bits/stdc++.h>

// エイリアス
using  ll = long signed long;
using ull = long unsigned long;
using  ld = long double;
using namespace std;

// エイリアス (補完・コンパイルが重くなる)
// #include <boost/multiprecision/cpp_int.hpp>
// using mll = boost::multiprecision::cpp_int;

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
#define FOREACH(i,q) for (auto &i : q)
template<class T> bool chmax(T &a, const T b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T b) { if (a > b) {a = b; return true;} return false; }
constexpr int INF = numeric_limits<int>::max();
constexpr long long LINF = numeric_limits<long long>::max();
constexpr long double EPS = 1e-10L;
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) DUMP_FUNC(q, #q, __FILE__, __LINE__)
template <typename T> void DUMP_PROC(T x) { cerr << x; }
void DUMP_PROC(string x) { cerr << '"' << x << '"'; }
template <typename T> void DUMP_PROC(vector<T> x) { cerr << "["; for (auto &xi : x) { DUMP_PROC(xi); cerr << (&xi != &*x.rbegin()?", ":""); } cerr << "]"; }
template <typename T> void DUMP_FUNC(T x, const char* name, const char* fn, int ln) { cerr << "\e[32m[DEBUG]\e[0m " << name << ": "; DUMP_PROC(x); cerr << " @ " << fn << "(" << ln << ")" << endl; }
template<class T> T gcd(T a, T b) { if (a < b) swap(a, b); while (b) swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// 標準入出力
struct inp {
    size_t sz;
    inp(size_t _sz = 1) : sz(_sz) {}
    template <typename T> operator T () const { T a; cin >> a; return a; }
    template <typename T> operator vector<T> () const { vector<T> a(sz); for (size_t i = 0; i < sz; i++) cin >> a[i]; return a; }
    template <typename T, typename U> operator pair<T, U> () const { T f; U s; cin >> f >> s; return pair<T, U>(f, s); }
};
inp inp1; // input one
template <typename T> void say(const T x, const char* end = "\n") { cout << x << end; }
void say(const ld x, const char* end = "\n") { cout << setprecision(30) << x << end; }
template <typename T> void say(const vector<T> x, const char* sep = " ", const char* end = "\n") { REP(i, x.size()) { cout << x[i] << (i+1 == i_len ? end : sep); } }
template <typename T> void say(const vector<vector<T>> x, const char* sep = " ", const char* end = "\n") { REP(i, x.size()) { say(x[i], sep, end); } }

// モジュール

// 2円交点, 点で交わらない場合は空vectorが返る
vector<pair<ld, ld>> circle_intersection(ld x1, ld y1, ld r1, ld x2, ld y2, ld r2) {
    const ld eps = 1e-10L, eps2 = 1e-20L;
    const ld dx = x1 - x2, dy = y1 - y2;
    const ld d2 = dx*dx + dy*dy;
    if (d2 <= -eps2 || (r1+r2)*(r1+r2) + eps2 <= d2) return {};
    const ld a = 0.5L * (d2 + r2*r2 - r1*r1);
    const ld w = sqrtl(max(0.L, d2 * r2*r2 - a*a));
    return {
        {x2 + (a * dx + dy * w) / d2,
         y2 + (a * dy - dx * w) / d2},
        {x2 + (a * dx - dy * w) / d2,
         y2 + (a * dy + dx * w) / d2}
    };
}

// 処理内容
int main() {
    
    ios::sync_with_stdio(false); // stdioを使うときはコメントアウトすること
    cin.tie(nullptr);            // インタラクティブ問題ではコメントアウトすること
    
    auto ci = circle_intersection(-1, 1, 4, 2, 5, 3);
    
    ll n = inp1;
    ll k = inp1;
    vector<tuple<ld, ld, ld>> xyc(n);
    REP(i, n) {
        ld x, y, c; cin >> x >> y >> c;
        xyc[i] = make_tuple(x, y, c);
    }

    ld ng = -0.1L;
    ld ok = 1e7L;

    while ((ok - ng) >= 1e-6) {

        const ld md = (ok + ng) / 2;

        vector<pair<ld, ld>> cand; cand.reserve(n*n);
        REP(i, n) {
            ld x1, y1, c1;
            tie(x1, y1, c1) = xyc[i];
            ld r1 = md / c1;
            cand.emplace_back(x1, y1);
            REP(j, i) {
                ld x2, y2, c2;
                tie(x2, y2, c2) = xyc[j];
                ld r2 = md / c2;
                auto ci = circle_intersection(x1, y1, r1, x2, y2, r2);
                if (!ci.empty()) {
                    cand.emplace_back(ci[0]);
                    cand.emplace_back(ci[1]);
                }
            }
        }
        ll vmax = 0;
        ld xm = 0, ym = 0;
        for (auto &p : cand) {
            ld x, y; tie(x, y) = p;
            ll v = 0;
            REP(i, n) {
                ld x1, y1, c1;
                tie(x1, y1, c1) = xyc[i];
                ld r1 = md / c1;
                if (hypotl(x-x1, y-y1) <= r1 + EPS) {
                    v++;
                }
            }
            if (chmax(vmax, v)) {
                xm = x;
                ym = y;
            }
        }
        cerr << "[debug] " << vmax << " at (" << xm << ", " << ym << ") on t = " << md << "\n";
        (vmax >= k ? ok : ng) = md;

    }

    chmax(ok, 0.L);
    say(ok);

}

Measured memory_bytes: 384