#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef tuple<ll, ll, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define REP(i,n) for (ll i = 0; i < n; ++i)
#define REPR(i,n) for (ll i = n-1; i >= 0; --i)
#define FOR(i,m,n) for (ll i = m; i < n; ++i)
#define FORR(i,m,n) for (ll i = n-1; i >= m; --i)
#define FORE(x,xs) for (const auto& x : xs)
#define ALL(v) v.begin(), v.end()
#define CHMIN(x,y) x = min(x, y)
#define CHMAX(x,y) x = max(x, y)

const ld EPS = 1e-10;

struct Vec2 {
    ld x, y;
    Vec2(ld x = 0, ld y = 0) : x(x), y(y) {}

    Vec2 &operator+=(const Vec2 &p) {
        x += p.x;
        y += p.y;
        return *this;
    }

    Vec2 &operator-=(const Vec2 &p) {
        x -= p.x;
        y -= p.y;
        return *this;
    }

    Vec2 &operator*=(const ld &a) {
        x *= a;
        y *= a;
        return *this;
    }

    Vec2 operator+(const Vec2 &p) const {
        return Vec2(*this) += p;
    }

    Vec2 operator-(const Vec2 &p) const {
        return Vec2(*this) -= p;
    }

    Vec2 operator*(const ld &a) const {
        return Vec2(*this) *= a;
    }

    ld sqrtNorm() const {
        return x*x + y*y;
    }

    ld norm() const {
        return sqrt(sqrtNorm());
    }

    Vec2 unit() const {
        return Vec2(*this) * (1/norm());
    }

    Vec2 rotate90() const {
        return Vec2(y, -x);
    }

    friend ostream &operator<<(ostream &os, const Vec2 &p) {
        return os << "{" << p.x << "," << p.y << "}";
    }
};

struct Circle {
    Vec2 o;
    ld r;
    Circle(Vec2 o = Vec2(), ld r = 0) : o(o), r(r) {}

    vector<Vec2> crossPoints(const Circle &c) {
        Vec2 v = c.o - o;
        ld l = v.norm();

        // 中心が近すぎると交点が存在しない
        if (abs(l) < EPS) return vector<Vec2>();

        // 円同士が外接/内接すると交点は一つ
        if (abs((l + r + c.r) - 2 * max({l, r, c.r})) < EPS) {
            if (abs(c.r - r - l) < EPS) return vector<Vec2>({o - v*(r/l)});
            return vector<Vec2>({o + v*(r/l)});
        }

        // 共有部分を持たない/内包しているなら交点が存在しない
        if (l + r + c.r < 2 * max({l, r, c.r})) return vector<Vec2>();

        ld x = (r*r + l*l - c.r*c.r) / (2*l);
        ld y = sqrt(r*r - x*x);
        Vec2 mid = o + v.unit() * x;
        Vec2 e = v.unit().rotate90();
        return vector<Vec2>({mid + e * y, mid - e * y});
    }

    bool isInside(const Vec2 &p) {
        return (p-o).norm() < r + EPS;
    }

    friend ostream &operator<<(ostream &os, const Circle &c) {
        return os << "O:" << c.o << ", r: " << c.r;
    }
};

const int MAX = 66;
int N, K;
ld X[MAX], Y[MAX], C[MAX];

vi nums, pairs;

Circle circles[MAX];

bool check(ld t) {
    REP (i, N) circles[i].r = t/C[i];
    REP (i, N) {
        int count = 0;
        REP (k, N) if (circles[k].isInside(circles[i].o)) count++;
        if (count >= K) return true;
    }

    REP (a, N) FOR (b, a+1, N) {
        FORE (p, circles[a].crossPoints(circles[b])) {
            int count = 0;
            REP (i, N) if (circles[i].isInside(p)) count++;
            if (count >= K) return true;
        }
    }
    return false;
}

ld solve() {
    if (K == 1) return 0;
    REP (i, N) circles[i] = Circle(Vec2(X[i], Y[i]), 0);
    ld ok = 300000, ng = 0;
    check(2.5);
    REP (q, 100) {
        ld mid = (ok + ng) / 2;
        if (check(mid)) ok = mid;
        else ng = mid;
    }
    return ok;
}

int main() {
    cin >> N >> K;
    REP (i, N) cin >> X[i] >> Y[i] >> C[i];
    cout << fixed << setprecision(15) << solve() << endl;
}

Measured memory_bytes: 384