// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

const long double eps = 1.0e-9;
bool equal(long double a, long double b) { return abs(a - b) < eps; }

struct V {
    long double x, y;
    V(long double x = 0.0, long double y = 0.0)
        : x(x), y(y) {}

    V operator+(const V other) const { return V(x + other.x, y + other.y); }
    V operator-(const V other) const { return V(x - other.x, y - other.y); }
    V operator*(long double a) const { return V(x * a, y * a); }
    long double sqNorm() { return x * x + y * y; }
    long double norm() { return sqrt(sqNorm()); }
    V rightRotate() { return V(y, -x); }
};

struct Circle {
    V o;
    long double r;
    Circle(V o = V(), long double r = 0.0)
        : o(o), r(r) {}

    vector<V> intersection(const Circle& other) {
        V v = other.o - o;
        long double l = v.norm();

        if (equal(l, 0.0)) return {};

        if (equal(l + r + other.r, 2.0 * max({ l, r, other.r }))) {
            if (other.contains(o))
                return { o - v * (r / l) };
            else
                return { o + v * (r / l) };
        }

        if (l + r + other.r < 2.0 * max({ l, r, other.r })) return {};

        long double x = (r * r - other.r * other.r + l * l) / (2 * l);
        long double d = sqrt(r * r - x * x);
        V y = o + v * (x / l);
        V z = v.rightRotate();
        return { y + z * (d / l), y - z * (d / l) };
    }

    bool contains(const V& p) const {
        return (o - p).norm() < r + eps;
    }
};

int n, k;
long double x[60], y[60], c[60];

int main() {
    fastio();

    cin >> n >> k;
    forn(i, n) {
        cin >> x[i] >> y[i] >> c[i];
    }

    long double l = 0.0, r = 300000.0;
    forn(i, 200) {
        long double t = (l + r) / 2.0;

        vec<V> ps;
        forn(i, n) ps.push_back(V(x[i], y[i]));

        forn(i, n) forn(j, i) {
            V a(x[i], y[i]), b(x[j], y[j]);
            Circle c1(a, t / c[i]), c2(b, t / c[j]);
            auto temp = c1.intersection(c2);
            ps.insert(ps.end(), all(temp));
        }

        bool ok = false;

        for (V p : ps) {
            int cnt = 0;
            forn(i, n) {
                Circle cur(V(x[i], y[i]), t / c[i]);
                cnt += cur.contains(p);
            }

            ok |= cnt >= k;
        }

        if (ok)
            r = t;
        else
            l = t;
    }

    cout << setprecision(20) << (l + r) / 2.0 << endl;

    return 0;
}

Measured memory_bytes: 384