#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

constexpr double eps = 1e-8;

struct Vec {
    static constexpr int N = 2;
    Vec() {}
    Vec(double x0, double x1) : x{ x0, x1 } {}
    double norm() const {
        double r = 0;
        for (int i = 0; i < N; i++) {
            r += x[i] * x[i];
        }
        return sqrt(r);
    }
    double inner(const Vec &v) const {
        double t = 0;
        for (int i = 0; i < N; i++) {
            t += x[i] * v.x[i];
        }
        return t;
    }
    Vec &rot90() {
        auto t = x[0];
        x[0] = x[1];
        x[1] = -t;
        return *this;
    }
    Vec &operator+=(const Vec &v) {
        for (int i = 0; i < N; i++) {
            x[i] += v.x[i];
        }
        return *this;
    }
    Vec &operator-=(const Vec &v) {
        for (int i = 0; i < N; i++) {
            x[i] -= v.x[i];
        }
        return *this;
    }
    Vec &operator*=(double t) {
        for (int i = 0; i < N; i++) {
            x[i] *= t;
        }
        return *this;
    }
    Vec operator+(const Vec &v) const {
        Vec r;
        for (int i = 0; i < N; i++) {
            r[i] = x[i] + v.x[i];
        }
        return r;
    }
    Vec operator-(const Vec &v) const {
        Vec r;
        for (int i = 0; i < N; i++) {
            r[i] = x[i] - v.x[i];
        }
        return r;
    }
    Vec operator*(double t) const {
        Vec r;
        for (int i = 0; i < N; i++) {
            r[i] = x[i] * t;
        }
        return r;
    }
    double &operator[](int i) {
        return x[i];
    }
    double x[N];
};

struct Circle {
    Circle() {}
    Circle(Vec o, double r) : o(o), r(r) {}
    int intersect(const Circle &c, Vec (&v)[2]) const {
        Vec v0 = c.o - o;
        double u = v0.norm();
        if (u < eps) return 0;
        double t = (r * r - c.r * c.r + u * u) / (u * 2);
        double s = r * r - t * t;
        if (s < -eps) return 0;
        if (s < eps) s = 0; else s = sqrt(s);
        v0 *= 1 / u;
        Vec v1 = v0; v1.rot90();
        v0 *= t;
        v1 *= s;
        v0 += o;
        for (int h = 0; h < 2; h++) {
            v[h] = v0 + v1;
            v1 *= -1;
        }
        return 2 - (s == 0.0);
    }
    Vec o;
    double r;
};

struct P {
    Vec v;
    int c;
};

int main() {
    int n, k;
    cin >> n >> k;

    vector<P> p(n);
    for (int i = 0; i < n; i++) {
        int x, y, c;
        cin >> x >> y >> c;
        p[i] = { Vec(x, y), c };
    }

    auto f = [&](Vec v, double r) {
        int s = 0;
        for (int i = 0; i < n; i++) {
            double t = (v - p[i].v).norm() * p[i].c;
            if (t < r + eps) s++;
        }
        return s >= k;
    };

    double t0 = 0, t1 = 100 * 2000;
    while (t1 - t0 > 1e-8) {
        double t = (t0 + t1) * 0.5;

        int b = 0;
        for (int i = 0; i < n; i++) {
            b |= f(p[i].v, t);
            if (b) break;
            for (int j = 0; j < i; j++) {
                Circle c0(p[i].v, t / p[i].c);
                Circle c1(p[j].v, t / p[j].c);
                Vec v[2];
                int k = c0.intersect(c1, v);
                for (int h = 0; h < k; h++) {
                    b |= f(v[h], t);
                    if (b) break;
                }
                if (b) break;
            }
            if (b) break;
        }

        (!b ? t0 : t1) = t;
    }

    printf("%.8f\n", t0);

    return 0;
}

Measured memory_bytes: 256