#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-8;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

using Point = complex<double>;

struct Circle {
    Point p;
    double r;
    Circle() = default;
    Circle(Point _p, double _r) : p(_p), r(_r) {}
};

inline bool equal(const double &a, const double &b) {
    return (abs(b - a) < EPS);
}

vector<Point> crossPoint(const Circle &c1, const Circle &c2) {
    vector<Point> res;
    // 2つの中心の距離
    double d = abs(c1.p - c2.p);
    // 2円が交点を持たない場合
    if(d > c1.r + c2.r + EPS) {
        return res;
    }
    if(d < abs(c1.r - c2.r) - EPS) {
        return res;
    }
    // 2円が接する場合
    if(equal(d, c1.r + c2.r)) {
        double t = c1.r / (c1.r + c2.r);
        res.emplace_back(c1.p + (c2.p - c1.p) * t);
        return res;
    }
    if(equal(d, abs(c1.r - c2.r))) {
        if(c2.r < c1.r - EPS) {
            res.emplace_back(c1.p + (c2.p - c1.p) * (c1.r / d));
        } else {
            res.emplace_back(c2.p + (c1.p - c2.p) * (c2.r / d));
        }
        return res;
    }
    // 2円が重なる場合
    double rc1 = (c1.r * c1.r + d * d - c2.r * c2.r) / (2 * d);
    double rs1 = sqrt(c1.r * c1.r - rc1 * rc1);
    if(c1.r - abs(rc1) < EPS) {
        rs1 = 0;
    }
    Point e12 = (c2.p - c1.p) / abs(c2.p - c1.p);
    res.emplace_back(c1.p + rc1 * e12 + rs1 * e12 * Point(0, 1));
    res.emplace_back(c1.p + rc1 * e12 + rs1 * e12 * Point(0, -1));
    return res;
}

// 点pが円cの内部(円周上も含む)に入っているかどうか
bool isInCircle(const Circle &c, const Point &p) {
    double d = abs(c.p - p);
    return (equal(d, c.r) || d < c.r - EPS);
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, k;
    cin >> n >> k;
    vector<Circle> circle(n);
    vector<double> c(n);
    for(int i = 0; i < n; i++) {
        double x, y;
        cin >> x >> y >> c[i];
        circle[i] = Circle(Point(x, y), 1.0);
    }

    vector<Point> p;

    auto check = [&](double X) {
        for(int i = 0; i < n; i++) {
            circle[i].r = X / c[i];
        }
        p.clear();
        for(int i = 0; i < n; i++) {
            p.emplace_back(circle[i].p);
        }
        for(int i = 0; i < n; i++) {
            for(int j = i + 1; j < n; j++) {
                auto res = crossPoint(circle[i], circle[j]);
                for(const auto &pp : res) {
                    p.emplace_back(pp);
                }
            }
        }
        int ans = 0;
        for(const auto &pp : p) {
            int cnt = 0;
            for(int i = 0; i < n; i++) {
                cnt += isInCircle(circle[i], pp);
            }
            chmax(ans, cnt);
        }
        return (ans >= k);
    };

    double ok = INF, ng = -0.1;
    int cnt = 100;
    while(cnt--) {
        double mid = (ok + ng) / 2.0;
        (check(mid) ? ok : ng) = mid;
    }
    cout << fixed << setprecision(10);
    cout << ok << endl;
}

Measured memory_bytes: 384