#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using PLI = pair<long long, int>;
using PLL = pair<long long, long long>;
template<class A, class B> ostream& operator <<(ostream& out, const pair<A, B> &p) {
    return out << "(" << p.first << ", " << p.second << ")";
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T>
ostream& operator <<(ostream& out, const deque<T>& a) {
  out << "["; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
  return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
  return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
  out << "{"; bool first = true;
  for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
  return out;
}
template<class T> inline void YES(T condition) { 
    if(condition) cout << "YES" << endl;
    else cout << "NO" << endl;
}
template<class T> inline void Yes(T condition) {
    if(condition) cout << "Yes" << endl;
    else cout << "No" << endl;
}
template<class T> T gcd(T a, T b) {
    while (b) {
        T tmp = b;
        b = a % b;
        a = tmp;
    }
    return a;
}
template<class T> T lcm(T a, T b){
    return a / gcd(a, b) * b;
}

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

long long qpow(long long a, long long b, int MOD) {
    if (b == 0) return 1;
    long long res = 1;
    while (b) {
        if (b & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        b >>= 1;
    }
    return res;
}

// const int MOD = 1e9 + 7;
// const int maxn = 2e6;
// int fac[maxn + 5];
// int invfac[maxn + 5];
// void init() {
//     fac[0] = 1;
//     for (int i = 1; i <= maxn; i++) fac[i] = 1LL * fac[i - 1] * i % MOD;
//     invfac[maxn] = (int)(qpow(fac[maxn], MOD - 2, MOD));
//     for (int i = maxn - 1; i >= 0; i--) invfac[i] = 1LL * invfac[i + 1] * (i + 1) % MOD;
// }
// int C(int n, int k) {
//     assert(0 <= k && n >= k);
//     int tmp = (int)(1LL * invfac[k] * invfac[n - k] % MOD);
//     return (int)(1LL * fac[n] * tmp % MOD);
// }

static constexpr LD eps = 1e-8;
using Point = complex<LD>;
using Line = pair<complex<LD>, complex<LD>>;
using Circle = struct Circle {
    complex<LD> center;
    LD r;
};
LD dot(Point a, Point b) {
    return (a.real() * b.real() + a.imag() * b.imag());
}
// modulo of cross product
// sign of result shows the angle from a to b
// counterclockwise-> +;  clockwise -> -;
LD cross(Point a, Point b) {
    return (a.real() * b.imag() - a.imag() * b.real());
}
// absolute modulo of cross product equals the area of parallelogram
LD distPL(Line a, Point b) {
    if (dot(a.second - a.first, b - a.first) < eps) return abs(b - a.first);
    if (dot(a.first - a.second, b - a.second) < eps) return abs(b - a.second);
    return abs(cross(a.second - a.first, b - a.first)) / abs(a.second - a.first);
}
// 0 should be eps??
int isIntersectedLL(Line a, Line b) {
    return (cross(a.second - a.first, b.first - a.first) * cross(a.second - a.first, b.second - a.first) < 0) && 
        (cross(b.second - b.first, a.first - b.first) * cross(b.second - b.first, a.second - b.first) < 0);
}
// res = a0 + k1(da) = b0 + k2(db)
// k1(da) = (b0 - a0) + k2(db)
// k1(da x db) = (b0 - a0) x db
// res = a0 + (cross(b0 - a0, db) / cross(da, db)) da
Point intersectionLL(Line a, Line b) {
    Point da = a.second - a.first;
    Point db = b.second - b.first;
    return a.first + da * cross(db, b.first - a.first) / cross(db, da);
}
// get distance of line to line by using 
// distance of point to line
LD distLL(Line a, Line b) {
    if (isIntersectedLL(a, b) == 1) return 0;
    return min({ distPL(a, b.first), 
                 distPL(a, b.second), 
                 distPL(b, a.first), 
                 distPL(b, a.second) });
}
// whether given point is inside the given circle
int isInsidePC(Point a, Circle b) {
    return abs(a - b.center) <= eps + b.r;
}
int isIntersectedCC(Circle a, Circle b) {
    LD dist = abs(a.center - b.center);
    return (dist <= eps + a.r + b.r) && (dist + eps >= abs(a.r - b.r));
}
pair<Point, Point> intersectionCC(Circle a, Circle b) {
    assert(isIntersectedCC(a, b));
    LD dist = abs(a.center - b.center);
    Point target = b.center - a.center;
    LD aa = dist * dist + a.r * a.r - b.r * b.r;
    aa /= 2.0L;
    LD h = sqrt(dist * dist * a.r * a.r - aa * aa);
    Point l{ (aa * target.real() + target.imag() * h) / (dist * dist), 
            (aa * target.imag() - target.real() * h) / (dist * dist)};
    Point r{ (aa * target.real() - target.imag() * h) / (dist * dist), 
            (aa * target.imag() + target.real() * h) / (dist * dist)};
    r = r + a.center;
    l = l + a.center;
    return make_pair(l, r);
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    cerr << fixed << setprecision(20);

    int n, k;
    cin >> n >> k;
    vector<LD> x(n), y(n), c(n);
    vector<Circle> vc(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> c[i];
        vc[i] = {{x[i], y[i]}, c[i]};
    }
    LD l = 0.0, r = 1e6;
    auto getCnt = [&](LD T) {
        int ans = 1;
        for (int i = 0; i < n; i++) vc[i].r = T / c[i];
        vector<Point> cdd;
        for (int i = 0; i < n; i++) {
            cdd.push_back(vc[i].center);
            for (int j = i + 1; j < n; j++) {
                if (isIntersectedCC(vc[i], vc[j])) {
                    pair<Point, Point> tmp = intersectionCC(vc[i], vc[j]);
                    cdd.push_back(tmp.first); cdd.push_back(tmp.second);
                }
            }
        }
        for (Point& cen: cdd) {
            int cnt = 0;
            for (auto& cir: vc) cnt += isInsidePC(cen, cir);
            ans = max(ans, cnt);
        }
        return ans;
    };

    while (r - l > eps) {
        LD mid = (l + r) / 2;
        if (getCnt(mid) < k)
            l = mid;
        else 
            r = mid;
    }
    // getCnt(2.4);
    cout << r << '\n';

    return 0;
}


Measured memory_bytes: 512