#include <iostream>
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <complex>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <map>
#include <queue>
#include <set>
#include <tuple>
#include <tuple>
using namespace std;
typedef long long ll;
#define _ << " " <<
#define all(X) (X).begin(), (X).end()
#define len(X) (X).size()
#define Pii pair<int, int>
#define Pll pair<ll, ll>
#define Tiii tuple<int, int, int>
#define Tlll tuple<ll, ll, ll>

double eps = 1e-8;

struct point {
    double x, y;
    point operator+(const point &p) {
        return {x + p.x, y + p.y};
    }
    point operator-(const point &p) {
        return {x - p.x, y - p.y};
    }
};

double distance(point A, point B, int deg) {
    point C = B - A;
    return pow(C.x*C.x + C.y*C.y, 0.5 * deg);
}

struct circle {
    point p;
    double r;
};

vector<point> intersect(circle A, circle B) {
    vector<point> ret;
    point X = A.p;
    B.p = B.p - A.p;
    A.p = {0, 0};
    //cerr << A.p.x _ A.p.y _ A.r _ B.p.x _ B.p.y _ B.r << endl;
    if (distance(A.p, B.p, 2) - pow(A.r + B.r, 2) > eps) return ret;
    double K = (B.p.x*B.p.x + B.p.y*B.p.y + A.r*A.r - B.r*B.r) / 2;
    double SQ = (B.p.x*B.p.x + B.p.y*B.p.y)*A.r*A.r - K * K;
    double DS = distance(A.p, B.p, 2);
    //cerr << K _ SQ _ DS << endl;
    if (abs(SQ) < eps) {
        ret.push_back({K*B.p.x / DS + X.x, K*B.p.y / DS + X.y});
        return ret;
    }
    ret.push_back({(K*B.p.x + B.p.y*sqrt(SQ)) / DS + X.x,
                   (K*B.p.y - B.p.x*sqrt(SQ)) / DS + X.y});
    ret.push_back({(K*B.p.x - B.p.y*sqrt(SQ)) / DS + X.x,
                   (K*B.p.y + B.p.x*sqrt(SQ)) / DS + X.y});
    return ret;
}
 

int main() {
    cout << fixed << setprecision(6);
    cerr << fixed << setprecision(6);
    /*
    int n;
    cin >> n;
    circle C[n];
    for (int i = 0; i < n; i++) {
        cin >> C[i].p.x >> C[i].p.y >> C[i].r;
    }
    vector<point> vec = intersect(C[0], C[1]);
    cout << vec.size() << endl;
    for (auto &i : vec) {
        cout << i.x _ i.y << endl;
    }*/
    
    int n, k;
    cin >> n >> k;
    point p[n];
    int cost[n];
    for (int i = 0; i < n; i++) {
        cin >> p[i].x >> p[i].y >> cost[i];
    }

    double ok = 1e12, ng = 0;
    for (int trr = 0; trr < 100; trr++) {
        circle C[n];
        double md = (ok + ng) / 2;
        //cout << md << endl;
        for (int i = 0; i < n; i++) {
            C[i].p = p[i];
            C[i].r = md / cost[i];
            //cout << C[i].r << " ";
        }
        //cout << endl;
        vector<point> intersect_points;
        for (int i = 0; i < n; i++) intersect_points.push_back(p[i]);
        for (int i = 0; i < n; i++) {
            for (int j = i + 1; j < n; j++) {
                vector<point> vec = intersect(C[i], C[j]);
                for (auto &x : vec) {
                    intersect_points.push_back(x);
                    //cerr << x.x _ x.y << endl;
                }
            }
        }
        bool yes = 0;
        for (auto &ip: intersect_points) {
            int cnt = 0;
            //cout << "!: " << ip.x _ ip.y << endl;
            for (int i = 0; i < n; i++) {
                cnt += (distance(ip, p[i], 1) < C[i].r 
                    || abs(C[i].r - distance(ip, p[i], 1)) < eps);
                //cout << distance(ip, p[i], 1) << " ";
            }
            yes = yes | (cnt >= k);
            //cout << cnt << endl;
        }
        if (yes) ok = md;
        else ng = md;
        //cerr << endl;
        //break;
    }
    cout << ok << endl;


}

Measured memory_bytes: 640