//
//  main.cpp
//

#include <algorithm>
#include <array>
#include <assert.h>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

using ll = int64_t;
using ull = uint64_t;
constexpr ll LL_MAX = numeric_limits<ll>::max();
constexpr ull ULL_MAX = numeric_limits<ull>::max();

template<typename T>
vector<T> make_vec_nd(T init, ll size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, ll size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define rrep(i, a, b) for (ll i = (a)-1; i >= (b); i--)

struct P {
    double x;
    double y;
    P operator+(P rhs) {
        return {x+rhs.x, y+rhs.y};
    }
    P operator-(P rhs) {
        return {x-rhs.x, y-rhs.y};
    }
    P operator-() {
        return {-x, -y};
    }
    double operator*(P rhs) {
        return x*rhs.x + y*rhs.y;
    }
    P operator*(double k) {
        return {x*k, y*k};
    }
    P operator/(double k) {
        return {x/k, y/k};
    }
    double len_sq() {
        return (*this)*(*this);
    }
    double len() {
        return sqrt(len_sq());
    }
};

pair<P, P> intersect(P p0, double r0, P p1, double r1) {
    double d = (p1 - p0).len();
    P e = (p1 - p0) / d;
    double lh = (r0 * r0 + d * d - r1 * r1) / (2 * d);
    P h = p0 + e * lh;
    double lp = sqrt(r0 * r0 - lh * lh);
    P p = P{-e.y, e.x} * lp;
    return make_pair(h + p, h - p);
}

int main() {
    ll N, K;
    cin >> N >> K;
    struct Meat {
        P p;
        double c;
    };
    vector<Meat> meats(N);
    rep(i,0,N) {
        cin >> meats[i].p.x >> meats[i].p.y >> meats[i].c;
    }
    double bad = 0.0;
    double good = 100 * 3000;
    while (good - bad > 1.0e-8) {
        double mid = (bad + good) / 2.0;
        vector<P> pts;
        rep(i,0,N) {
            rep(j,i+1,N) {
                Meat meat0 = meats[i];
                Meat meat1 = meats[j];
                double rad0 = mid / meat0.c;
                double rad1 = mid / meat1.c;
                P p0 = meat0.p;
                P p1 = meat1.p;
                if ((p0-p1).len() > rad0 + rad1) {
                    continue;
                }
                if (rad0 > (p0-p1).len() + rad1) {
                    continue;
                }
                if (rad1 > (p0-p1).len() + rad0) {
                    continue;
                }
                pair<P, P> p2 = intersect(p0, rad0, p1, rad1);
                pts.push_back(p2.first);
                pts.push_back(p2.second);
            }
        }
        rep(i,0,N) {
            pts.push_back(meats[i].p);
        }
        ll ok = false;
        for (auto& p : pts) {
            ll cnt = 0;
            rep(i,0,N) {
                Meat meat0 = meats[i];
                double rad0 = mid / meat0.c;
                P p0 = meat0.p;
                if ((p-p0).len() <= rad0 + 1.0e-7) {
                    cnt++;
                }
            }
            if (cnt >= K) {
                ok = true;
                break;
            }
        }
        if (ok) {
            good = mid;
        } else {
            bad = mid;
        }
    }
    cout << fixed << setprecision(10) << good << endl;
}


Measured memory_bytes: 384