#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>
#include <assert.h>
#include <bitset>
#include <list>
#include <cmath>

#define double long double
auto& in = std::cin;
auto& out = std::cout;
#define all_range(C) std::begin(C), std::end(C)
const double PI = 3.141592653589793238462643383279502884197169399375105820974944;

int32_t N,K;
double xpos[100];
double ypos[100];
double c[100];



template<typename FUNC>
//区間[b,e)　でf(r)==trueとなる最大のrを探す
//predの条件：(f(i) == true && f(j) == false) ==> (i < j)
//　　　　　　f(b) == true && f(e) == false
double binary_search_D(double b, double e, FUNC&& f)
{
    //回数=幅～1 + 1～許容誤差
    for (size_t i = 0; i < 100; ++i)
    {
        auto mid = (b + e) / 2;
        if (f(mid)) {
            b = mid;
        }
        else {
            e = mid;
        }
    }
    return b;
}
struct Circle {
    double x, y, r;
};
std::vector<std::pair<double,double>> clcl(Circle xyr1, Circle xyr2)
{
    std::vector<std::pair<double, double>> res;
    double  rksq, rlsq, xlk, ylk, distsq, delrsq, sumrsq, root, dstinv,
        scl, xfac, yfac, x, y, x1, y1, x2, y2;
    double  accy = 1.0E-15;

    rksq = pow(xyr1.r, 2.0);
    rlsq = pow(xyr2.r, 2.0);
    xlk = xyr2.x - xyr1.x;
    ylk = xyr2.y - xyr1.y;

    distsq = pow(xlk, 2.0) + pow(ylk, 2.0);

    if (distsq < accy) {
        return res;
    }

    delrsq = rlsq - rksq;
    sumrsq = rksq + rlsq;
    root = 2.0 * sumrsq * distsq - pow(distsq, 2.0) - pow(delrsq, 2.0);

    if (root < -accy) {
        return res;
    }

    dstinv = 0.5 / distsq;
    scl = 0.5 - delrsq * dstinv;
    x = xlk * scl + xyr1.x;
    y = ylk * scl + xyr1.y;

    if (root < accy) {   /* 2つの円は接する。*/
        res.emplace_back(x, y);
        return res;
    }

    root = dstinv * sqrt(root);
    xfac = xlk * root;
    yfac = ylk * root;
    x1 = x - yfac;
    y1 = y + xfac;
    x2 = x + yfac;
    y2 = y - xfac;
    res.emplace_back(x1, y1);
    res.emplace_back(x2, y2);
    return res;

}

double dist(double xdiff, double ydiff)
{
    return sqrt(xdiff * xdiff + ydiff * ydiff);
}


int main()
{
    using std::endl;
    in.sync_with_stdio(false);
    out.sync_with_stdio(false);
    in.tie(nullptr);
    out.tie(nullptr);

    in >> N>>K;
    for (int i = 0; i < N; i++)
    {
        in >> xpos[i] >> ypos[i] >> c[i];
    }

    if (K == 1) {
        out << 0 << endl;
        return 0;
    }
    if (K == 2) {
        double min = 500000;
        for (int i = 0; i < N; i++)
            for (int j = i+1; j < N; j++)
        {
               min = std::min(min, dist(xpos[i] - xpos[j], ypos[i] - ypos[j]) * c[i]* c[j] / (c[i] + c[j]));
        }
        out << std::fixed << std::setprecision(9) << min << endl;
        return 0;
    }

    out << std::fixed << std::setprecision(9)
        << -binary_search_D(-500000, 1, [](auto mid) {
            auto time = -mid;

            for (int i = 0; i < N; i++)
            {
                int count_in = 0;
                for (int j = i + 1; j < N; j++)
                {
                    if (dist(xpos[i] - xpos[j], ypos[i] - ypos[j]) + time / c[i] <= time / c[j]) {
                        ++count_in;
                    }
                    auto cross = clcl({ xpos[i],ypos[i],time / c[i] * 1.00000001 }, { xpos[j],ypos[j],time / c[j] * 1.00000001 });
                    auto distrrr = c[i] / (c[i] + c[j]);
                    cross.emplace_back(
                        xpos[i] + (xpos[j] - xpos[i]) * distrrr,
                        ypos[i] + (ypos[j] - ypos[i]) * distrrr
                    );
                    cross.emplace_back(
                        xpos[i],
                        ypos[i]
                    );
                    cross.emplace_back(
                        xpos[j],
                        ypos[j]
                    );
                    for (auto& pos : cross)
                    {
                        int count = 0;
                        for (int k = 0; k < N; k++)
                        {
                            if (dist(xpos[k] - pos.first, ypos[k] - pos.second) * c[k] *0.9999999 <= time) {
                                ++count;
                            }
                        }
                        if (K <= count) {
                            return true;
                        }
                    }
                }
                if (K <= count_in) {
                    return true;
                }
            }
            return false;

        })<<endl;

    return 0;
}
#endif


Measured memory_bytes: 384