import std.stdio, std.string, std.conv, std.range;
import std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


enum eps = 1e-9;

alias Point = Tuple!(double, "x", double, "y");

void main() {
    int N, K;
    scan(N, K);
    auto x = new double[](N);
    auto y = new double[](N);
    auto c = new double[](N);
    foreach (i ; 0 .. N) {
        scan(x[i], y[i], c[i]);
    }

    bool check(double t) {
        auto r = new double[](N);
        foreach (i ; 0 .. N) {
            r[i] = (t / c[i]);
        }

        Point[] tens;

        foreach (i ; 0 .. N) {
            tens ~= Point(x[i], y[i]);
            foreach (j ; i + 1 .. N) {
                auto d = hypot(x[i] - x[j], y[i] - y[j]);

                // ２つの円が交わらないとき
                if (r[i] + r[j] < d - eps) continue;
                // 一方の円がもう一方に完全に含まれている場合
                if (r[j] > r[i] + d + eps || r[j] < r[i] - d - eps) continue;

                // 交点が存在する場合
                auto theta = acos((r[i]*r[i] + d*d - r[j]*r[j]) / (2 * d * r[i]));
                auto v = Point((x[j] - x[i]) * r[i] / d, (y[j] - y[i]) * r[i] / d);
                auto p1 = Point(x[i] + v.x * cos(theta) - v.y * sin(theta),
                                y[i] + v.x * sin(theta) + v.y * cos(theta));
                auto p2 = Point(x[i] + v.x * cos(-theta) - v.y * sin(-theta),
                                y[i] + v.x * sin(-theta) + v.y * cos(-theta));
                tens ~= p1;
                tens ~= p2;
            }
        }

        int cmax;
        foreach (p ; tens) {
            int cnt;
            foreach (i ; 0 .. N) {
                if (hypot(p.x - x[i], p.y - y[i]) < r[i] + eps) {
                    cnt++;
                }
            }
            chmax(cmax, cnt);
        }

        return cmax >= K;
    }

    double ng = 0, ok = inf;
    foreach (i ; 0 .. 200) {
        auto mid = (ng + ok) / 2.0;
        (check(mid) ? ok : ng) = mid;
    }

    auto ans = ok;
    writefln("%.12f", ans);
}






void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}
