#include <iostream>
#include <sstream>
#include <stack>
#include <iomanip>
#include <numeric>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>

#define BEGIN(x) x.begin()
#define END(x) x.end()
#define ALL(x) BEGIN(x), END(x)
#define PAIR make_pair
#define VEC(type) vector<type >
#define endl '\n'

#define FOR(i, A, B) for(auto i = (A);i != (B); i++)
#define FORD(i, A, B) for(auto i = (A);i != (B); i--)

#define READRANGE(begin, end) FOR(it, begin, end) cin >> *it
#define READVEC(V) READRANGE(BEGIN(V), END(V))

using namespace std;

typedef long long lint;
typedef pair<int, int> Pii;
typedef pair<int, lint> Pil;
typedef pair<lint, lint> Pll;
typedef pair<lint, int> Pli;

template<class U, class V>
istream& operator >>(istream& in, pair<U, V>& pr) {
    return in >> pr.first >> pr.second;
}

template<class U, class V>
ostream& operator <<(ostream& out, pair<U, V>& p) {
    return out << p.first << " " << p.second;
}

template<class T>
ostream& operator <<(ostream& out, vector<T> vec) {
    for (T& e : vec)
        out << e << " ";
    return out << endl;
}

// ---- BEGIN LIBRARY CODE ----
// ---- END LIBRARY CODE ----
void io_init()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
};

const double EPS = 1e-9;

double pointDist(double x0, double y0, double x1, double y1)
{
    double dx = x0 - x1, dy = y0 - y1;
    return sqrt(dx * dx + dy * dy);
};

int count(VEC(double)& X, VEC(double)& Y, VEC(double)& R, double x, double y)
{
    int ret = 0;
    const int N = X.size();
    FOR(i, 0, N) {
        if (pointDist(X[i], Y[i], x, y) < R[i] + EPS)
            ret++;
    }

    return ret;
};

vector<pair<double, double> > rotate(double x, double y, double mag)
{
    vector<pair<double, double> > ret(2);
    if (mag <= EPS) {
        ret[1] = ret[0] = {0, 0};
        return ret;
    }

    double fac = pointDist(0, 0, x, y) / mag;
    ret[0] = {(-y) / fac, x / fac};
    ret[1] = {y / fac, (-x) / fac};
    return ret;
};

int check(VEC(double)& X, VEC(double)& Y, VEC(double)& C, double t, int K)
{
    const int N = X.size();
    VEC(double) R(N);
    FOR(i, 0, N) {
        R[i] = t / C[i];
    }

    FOR(i, 0, N)
        if (count(X, Y, R, X[i], Y[i]) >= K)
            return K;

    FOR(i, 0, N)
        FOR(j, i + 1, N) {
            double x1 = X[i], y1 = Y[i], r1 = R[i];
            double x2 = X[j], y2 = Y[j], r2 = R[j];

            double dCenter = pointDist(x1, y1, x2, y2);
            if (dCenter >= r1 + r2 + EPS || dCenter <= fabs(r1 - r2) - EPS)
                continue;

            double vx = x2 - x1, vy = y2 - y1;

            double dTo = (dCenter * dCenter + r1 * r1 - r2 * r2) / 2.0 / dCenter;
            double mag = sqrt(r1 * r1 - dTo * dTo);

            double xx = x1 + (x2 - x1) / dCenter * dTo;
            double yy = y1 + (y2 - y1) / dCenter * dTo;
            vector<pair<double, double> > vt = rotate(vx, vy, mag);
            for (auto pt : vt) {
                double xcand = xx + pt.first;
                double ycand = yy + pt.second;
                if (count(X, Y, R, xcand, ycand) >= K)
                    return K;
            }
        }

    return 0;
};

int main(int argc, char **argv)
{
    io_init();

    // Actual program code starts here.
    int N, K;
    cin >> N >> K;
    VEC(double) X(N), Y(N), C(N);
    FOR(i, 0, N) {
        cin >> X[i] >> Y[i] >> C[i];
    }

    double lo = 0.0, hi = 1e10;
    while (hi - lo > EPS) {
        double mid = (lo + hi) / 2;
        if (check(X, Y, C, mid, K) >= K)
            hi = mid;
        else
            lo = mid;
    }

    cout << fixed << setprecision(10) << lo << endl;
    return 0;
};

Measured memory_bytes: 384