#include <bits/stdc++.h>
#define endl '\n'
#define ALL(v) std::begin(v), std::end(v)
#define ALLR(v) std::rbegin(v), std::rend(v)
using ll = std::int64_t;
using ull = std::uint64_t;
using pll = std::pair<ll, ll>;
using tll = std::tuple<ll, ll, ll>;
template <typename T> using vec = std::vector<T>;
template <typename T> using vvec = vec<vec<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return vec<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec


namespace geo {

const double eps = 1e-6;
const long double pi = 3.14159265358979323846264338327950288419716939937510L;

using Point = std::complex<double>;
const double err_v = std::numeric_limits<double>::max();
const Point err_p(err_v, err_v);

struct DualPoints : public std::pair<Point, Point> {
    using std::pair<Point, Point>::pair;

    Point& operator [](size_t idx) { return idx == 0 ? first : second; }
    
    const Point& operator [](size_t idx) const { return idx == 0 ? first : second; }
};

struct get_xy {
    double &x, &y;

    get_xy(double &x, double &y) : x(x), y(y) { }

    get_xy& operator =(const Point &p) {
        x = std::real(p);
        y = std::imag(p);
        return *this;
    }
};

struct Circle {
    Point p;
    double r;

    Circle(Point p, double r) : p(p), r(r) { }
};

struct Line : public DualPoints {
    using DualPoints::DualPoints;
};

struct Seg : public DualPoints {
    using DualPoints::DualPoints;
};

double dot(const Point &a, const Point &b) {
    return (std::conj(a) * b).real();
}

double cross(const Point &a, const Point &b) {
    return (std::conj(a) * b).imag();
}

enum ccwd {
    Clock = -1,
    CoClock = 1,
    CAB = 2,
    ABC = -2,
    ACB = 0,
};

ccwd ccw(Point a, Point b, Point c) {
    b -= a;
    c -= a;
    double p, q;
    {
        auto tmp = std::conj(b) * c;
        p = tmp.real();
        q = tmp.imag();
    }
    if (0 < q) return CoClock;
    if (q < 0) return Clock;
    if (p < 0) return CAB;
    if (std::norm(b) < std::norm(c)) return ABC;
    return ACB;
}

bool is_zero(double a) {
    return std::abs(a) <= eps;
}

bool eq(double a, double b) {
    return is_zero(a - b);
}

bool is_parallel(const Line &l1, const Line &l2) {
    return is_zero(cross(l1[1] - l1[0], l2[1] - l2[0]));
}

bool is_same_line(Point o, Point a, Point b) {
    return is_zero(cross(a - o, b - o));
}

bool intersect(const Line &p, const Line &q) {
    if (!is_parallel(p, q)) return true;
    return is_same_line(p[0], p[1], q[1]);
}

bool intersect(const Line &l, const Seg &s) {
    double a = cross(l[1] - l[0], s[0] - l[0]);
    double b = cross(l[1] - l[0], s[1] - l[0]);
    return a * b < 0;
}

bool intersect(const Seg &p, const Seg &q) {
    bool pf = (ccw(p[0], p[1], q[0]) * ccw(p[0], p[1], q[1])) <= 0;
    bool qf = (ccw(q[0], q[1], p[0]) * ccw(q[0], q[1], p[1])) <= 0;
    return pf && qf;
}

bool intersect(const Line &l, const Point &p) {
    return is_same_line(p, l[0], l[1]);
}

bool intersect(const Seg &s, const Point &p) {
    double l1 = std::abs(s[0] - s[1]);
    double l2 = std::abs(s[0] - p);
    double l3 = std::abs(s[1] - p);
    return is_zero(l2 + l3 - l1);
}

// projection from p to l
Point proj(const Line &l, const Point &p) {
    double mul = dot(p - l[0], l[1] - l[0]) / norm(l[0] - l[1]);  // cos(theta) / (p-l[0]).norm()
    return l[0] + mul * (l[1] - l[0]);
}

Point refl(const Line &l, const Point &p) {
    Point pr = proj(l, p);
    return p + (2. * (pr - p));
}

double distance(const Point &p1, const Point &p2) {
    return std::abs(p1 - p2);
}

double distance(const Line &l, const Point &p) {
    return std::abs(p - proj(l, p));
}

double distance(const Line &p, const Line &q) {
    if (is_parallel(p, q)) return distance(p, q[0]);
    return 0;
}

double distance(const Line &l, const Seg &s) {
    if (intersect(l, s)) return 0;
    return std::min(distance(l, s[0]), distance(l, s[1]));
}

double distance(const Seg &s, const Point &p) {
    Line l(s[0], s[1]);
    Point pr = proj(l, p);
    if (intersect(s, pr)) return std::abs(pr - p);
    return std::min(std::abs(s[0] - p), std::abs(s[1] - p));
}

double distance(const Seg &p, const Seg &q) {
    if (intersect(p, q)) return 0;
    return var_min(distance(p, q[0]), distance(p, q[1]),
                   distance(q, p[0]), distance(q, p[1]));
}

double fix_arg(double arg) {
    arg += 2 * pi;
    if (2 * pi <= arg) arg -= 2 * pi;
    return arg;
}

bool comp_coclock(const Point &p1, const Point &p2) {
    return fix_arg(arg(p1)) < fix_arg(arg(p2));
}

Point rotate(const Point &p, double arg) {
    std::complex<double> r(std::cos(arg), std::sin(arg));
    return p * r;
}

int intersect(const Circle &c1, const Circle &c2) {
    if (c1.r < c2.r) return intersect(c2, c1);
    double d = distance(c1.p, c2.p);
    if (d + c2.r < c1.r) return 1;
    if (eq(d + c2.r, c1.r)) return 2;
    if (d < c1.r + c2.r) return 3;
    if (eq(c1.r - c2.r, d)) return 4;
    return 0;
}

double cos(double a, double b, double c) {
    return (a * a + b * b - c * c) / (2 * a * b);
}

std::pair<Point, Point> crosspoint(const Circle &c1, const Circle &c2) {
    double d = distance(c1.p, c2.p);
    double rc = cos(d, c1.r, c2.r) * c1.r;
    double rs = std::sqrt(c1.r * c1.r - rc * rc);
    auto unit_v = (c2.p - c1.p) / d;
    return std::make_pair(c1.p + unit_v * Point(rc, rs),
                          c1.p + unit_v * Point(rc, -rs));
}

}

using namespace std;
const double inf = 5e15;

// cr1 \in cr2
bool cr_in(const geo::Circle &cr1, const geo::Circle &cr2) {
    auto st = geo::intersect(cr1, cr2);
    return (st == 1 || st == 2) && cr1.r <= cr2.r;
}

int main() {
    ll n, K;
    cin >> n >> K;
    vec<tll> cs(n);
    for (auto &&e : cs) {
        ll x, y, c;
        cin >> x >> y >> c;
        e = tll(x, y, c);
    }

    double ok = 1e18, ng = 0;
    for (ll loop = 0; loop < 300 / 2; loop++) {
        double mid = (ok + ng) / 2;
        vec<geo::Circle> css;
        for (ll i = 0; i < n; i++) {
            ll x, y, cl;
            tie(x, y, cl) = cs[i];
            css.emplace_back(geo::Point(x, y), mid / cl);
        }

        vvec<ll> c_in(n);
        for (ll i = 0; i < n; i++) for (ll j = 0; j < n; j++) {
            if (i == j) c_in[i].push_back(j);
            else if (cr_in(css[i], css[j])) c_in[i].push_back(j);
        }

        bool flag = false;
        for (ll i = 0; i < n; i++) if (K <= c_in[i].size()) flag = true;
        for (ll i = 0; i < n; i++) for (ll j = i + 1; j < n; j++) {
            if (geo::intersect(css[i], css[j]) <= 1) continue;
            geo::Point p1, p2;
            tie(p1, p2) = geo::crosspoint(css[i], css[j]);
            geo::Point ps[] = { p1, p2, };
            for (auto &&p : ps) {
                ll cnt = 0;
                for (ll k = 0; k < n; k++) {
                    if (cr_in(css[i], css[k]) || cr_in(css[j], css[k])) {
                        cnt++;
                        continue;
                    }
                    auto dist = geo::distance(css[k].p, p);
                    if (dist < css[k].r + geo::eps) cnt++;
                }
                if (K <= cnt) {
                    flag = true;
                    break;
                }
            }
        }
        (flag ? ok : ng) = mid;
    }
    cout << ok << endl;
    return 0;
}


Measured memory_bytes: 384