#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
//#pragma GCC optimize(3)
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC target("sse3","sse2","sse")
//#pragma GCC target("avx","sse4","sse4.1","sse4.2","ssse3")
//#pragma GCC target("f16c")
//#pragma GCC optimize("inline","fast-math","unroll-loops","no-stack-protector")
//#pragma GCC diagnostic error "-fwhole-program"
//#pragma GCC diagnostic error "-fcse-skip-blocks"
//#pragma GCC diagnostic error "-funsafe-loop-optimizations"
//#pragma GCC diagnostic error "-std=c++14"
#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"

#define PB push_back
#define PF push_front
#define LB lower_bound
#define UB upper_bound
#define fr(x) freopen(x,"r",stdin)
#define fw(x) freopen(x,"w",stdout)
#define REP(x, l, u) for(ll x = l;x<u;x++)
#define RREP(x, l, u) for(ll x = l;x>=u;x--)
#define complete_unique(a) a.erase(unique(begin(a),end(a)),end(a))
#define mst(x, a) memset(x,a,sizeof(x))
#define all(a) begin(a),end(a)
#define rall(a) rbegin(a),rend(a)
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define MP make_pair
#define lowbit(x) ((x)&(-(x)))
#define bitcnt(x) (__builtin_popcountll(x))
#define lson (ind<<1)
#define rson (ind<<1|1)
#define se second
#define fi first
#define sz(x) ((int)x.size())
#define EX0 exit(0);

typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ld;
using namespace __gnu_pbds; //required
using namespace std;
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
typedef vector<ll> VLL;
typedef vector<int> VI;
const ll mod = 1e9 + 7;


string to_string (string s) { return '"' + s + '"'; }

string to_string (const char *s) { return to_string ((string) s); }

string to_string (bool b) { return (b ? "true" : "false"); }

template<typename A, typename B>
string to_string (pair<A, B> p) { return "(" + to_string (p.first) + ", " + to_string (p.second) + ")"; }

template<typename A>
string to_string (A v) {
    bool first = true;
    string res = "{";
    for (const auto &x : v) {
        if (!first) { res += ", "; }
        first = false;
        res += to_string (x);
    }
    res += "}";
    return res;
}

void debug_out () { cerr<<endl; }

template<typename Head, typename... Tail>
void debug_out (Head H, Tail... T) {
    cerr<<" "<<to_string (H);
    debug_out (T...);
}

#ifdef LOCAL
#define dbg(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define dbg(...) {}
#endif

template<typename T, typename S>
inline bool upmin (T &a, const S &b) { return a > b ? a = b, 1 : 0; }

template<typename T, typename S>
inline bool upmax (T &a, const S &b) { return a < b ? a = b, 1 : 0; }


ull twop (ll x) { return 1ULL<<x; }

ll MOD (ll a, ll m) {
    a %= m;
    if (a < 0)a += m;
    return a;
}

ll inverse (ll a, ll m) {
    a = MOD (a, m);
    if (a <= 1)return a;
    return MOD ((1 - inverse (m, a) * m) / a, m);
}

template<typename T>
T sqr (T x) { return x * x; }

ll gcd (ll a, ll b) {
    a = abs (a), b = abs (b);
    while (b != 0) {
        a %= b;
        swap (a, b);
    }
    return a;
}

ll fast (ll a, ll b, ll mod) {
    if (b < 0)a = inverse (a, mod), b = -b;
    ll ans = 1;
    while (b) {
        if (b & 1)ans = ans * a % mod;
        a = a * a % mod;
        b /= 2;
    }
    return ans % mod;
}

using flt = double;
using int64 = long long;

const flt eps = 1e-8, pi = acos (-1.0);

template<class T>
inline int sgn (T x, T e = eps) { return x < -e ? -1 : x > e; }


template<class T>
inline T cmp (T a, T b, T e = eps) {
    return std::abs (a - b) >= e + std::abs (a) * e ? a - b : 0;
}

inline flt fix (flt x, flt e = eps) { return cmp (x, flt (0), e); }

template<class T>
struct Point {
    T x, y;
    
    Point (T x = 0, T y = 0) : x (x), y (y) {}
    
    bool operator< (const Point &o) const { return x < o.x || (x == o.x && y < o.y); }
    
    bool operator== (const Point &o) const { return x == o.x && y == o.y; }
    
    Point operator+ (const Point &o) const { return Point (x + o.x, y + o.y); }
    
    Point operator- (const Point &o) const { return Point (x - o.x, y - o.y); }
    
    Point operator* (T k) const { return Point (x * k, y * k); }
    
    Point operator/ (T k) const { return Point (x / k, y / k); }
    
    T dot (const Point &o) const { return x * o.x + y * o.y; }
    
    T det (const Point &o) const { return x * o.y - y * o.x; }
    
    T norm2 () const { return x * x + y * y; }
    
    flt norm () const { return hypot (x, y); }
    
    flt ang () const { return atan2 (y, x); }
    
    Point perp () const { return Point (-y, x); } // rotate 90 degrees
    Point unit () const { return *this / norm (); }
    
    Point trunc (flt k) const { return unit () * k; }
    
    // counter clockwise rotate a rad
    Point rot (flt a) const {
        return Point (x * cos (a) - y * sin (a), x * sin (a) + y * cos (a));
    }
    
    // counter clockwise rotate using cos/sin
    Point rot (flt cosa, flt sina) const {
        return Point (x * cosa - y * sina, x * sina + y * cosa);
    }
};

using point = Point<flt>;
using poly_t = std::vector<point>;

template<class P>
bool on_seg (const P &a, const P &b, const P &o) {
    return sgn ((a - o).det (b - o)) == 0 && sgn ((a - o).dot (b - o)) <= 0;
}

template<class P>
bool is_parallel (const P &a, const P &b, const P &c, const P &d) {
    return sgn ((b - a).det (d - c)) == 0;
}

// find intersection of segments ab and cd, stored in p
template<class P>
bool seg_inter (const P &a, const P &b, const P &c, const P &d, P &p) {
    if (on_seg (a, b, c)) return p = c, true;
    if (on_seg (a, b, d)) return p = d, true;
    if (on_seg (c, d, a)) return p = a, true;
    if (on_seg (c, d, b)) return p = b, true;
    P ab{b - a}, cd{d - c};
    if (sgn (ab.det (cd)) == 0) return false; // parallel
    int d1 = sgn (ab.det (c - a)) * sgn (ab.det (d - a));
    int d2 = sgn (cd.det (a - c)) * sgn (cd.det (b - c));
    p = a + ab * (cd.det (c - a) / cd.det (ab));
    return d1 < 0 && d2 < 0;
}

// find intersection of lines ab and cd, stored in p
template<class P>
bool line_inter (const P &a, const P &b, const P &c, const P &d, P &p) {
    P ab{b - a}, cd{d - c};
    if (sgn (ab.det (cd)) == 0) return false; // parallel
    p = a + ab * (cd.det (c - a) / cd.det (ab));
    return true;
}

// minimum distance from o to segment ab
template<class P>
flt dis2seg (const P &a, const P &b, const P &o) {
    P ao{o - a}, bo{o - b}, ab{b - a};
    if (sgn (ao.dot (ab)) < 0) return ao.norm ();
    if (sgn (-bo.dot (ab)) < 0) return bo.norm ();
    return std::abs (ao.det (ab)) / ab.norm ();
}

// find the minimum distance from segment ab to segment cd
template<class P>
flt dis_seg2seg (const P &a, const P &b, const P &c, const P &d) {
    P o;
    if (seg_inter (a, b, c, d, o)) return 0;
    else
        return std::min (std::min (dis2seg (a, b, c), dis2seg (a, b, d)),
                         std::min (dis2seg (c, d, a), dis2seg (c, d, b)));
}

// move line AB along normal vector
void move_d (point &a, point &b, const flt len) {
    auto d = (b - a).perp ().trunc (len);
    a = a + d, b = b + d;
}

// project point o on line ab
point project (const point &a, const point &b, const point &o) {
    auto ab = b - a;
    return a + ab * (ab.dot (o - a) / ab.norm2 ());
}

// find the reflect point of o with respect to line ab
point reflect (const point &a, const point &b, const point &o) {
    auto ab = b - a;
    return (a + ab * (ab.dot (o - a) / ab.norm2 ())) * 2 - o;
}

/************************************ Circle Utilities *****************************************/
// check if two circles intersect, intersection will store in P and Q
bool intersect (const point &A, flt ra, const point &B, flt rb, point &P, point &Q) {
    point AB (B - A);
    double dis = AB.norm ();
    if (sgn (dis - (ra + rb)) > 0 || sgn (dis - fabs (ra - rb)) < 0) return false;
    flt cosa = (dis * dis + ra * ra - rb * rb) / (2 * dis * ra);
    flt sina = sqrt (fix (1.0 - cosa * cosa));
    AB = AB * (ra / dis);
    P = AB.rot (cosa, +sina) + A;
    Q = AB.rot (cosa, -sina) + A;
    return true;
}

// check if line AB intesect circle O, intersection will store in P and Q
bool intersect (const point &A, const point &B, const point &O, flt r, point &P, point &Q) {
    point AB (B - A), AO (O - A);
    flt dis = fabs (AB.det (AO)) / AB.norm ();
    if (sgn (dis - r) > 0) return false;
    point M = A + AB * (AB.dot (AO) / AB.norm2 ());
    dis = sqrt (fix (r * r - dis * dis));
    AB = AB / AB.norm () * dis;
    P = M + AB, Q = M - AB;
    return true;
}

namespace SOLVE {
    ll n, k;
    point p[1000];
    flt c[1000];
    flt r[1000];
    
    bool check (flt threshold) {
        REP(i, 0, n)r[i] = threshold / c[i];
        vector<point> candidate;
        REP(i, 0, n) {
            REP(j, i+1, n) {
                point x, y;
                if (intersect (p[i], r[i], p[j], r[j], x, y)) {
                    dbg(x.x, x.y);
                    dbg(y.x, y.y);
                    dbg(p[i].x, p[i].y, r[i]);
                    dbg(p[j].x, p[j].y, r[j]);
                    candidate.PB (x);
                    candidate.PB (y);
                }
            }
            dbg(p[i].x, p[i].y);
            candidate.PB (p[i]);
        }
        for (auto x:candidate) {
            int cnt = 0;
            dbg(x.x, x.y);
            REP(i, 0, n) {
                if (sgn ((x - p[i]).norm () - r[i]) <= 0) cnt++;
            }
            dbg(cnt);
            if (cnt >= k)return true;
        }
        return false;
    }
    
    void main () {
        cin>>n>>k;
        REP(i, 0, n) {
            cin>>p[i].x>>p[i].y>>c[i];
        }
        flt l = 0, r = 1e20;
        REP(i, 1, 100) {
            auto mid = (l + r) / 2;
            if (check (mid)) {
                r = mid;
            } else {
                l = mid ;
            }
        }
        dbg(check (0));
        printf ("%.10f", l);
    }
}


signed main () {
#ifdef LOCAL
    fr("/Users/zhangqingchuan/Desktop/cp/cp/input.txt");
    fw("/Users/zhangqingchuan/Desktop/cp/cp/output.txt");
#endif
    
    
    int t = 1;
//    cin >> t;
    for (int i = 1; i <= t; i++) {
//        cout<<"Case #"<<i<<": ";
        SOLVE::main ();
        
    }








//    clock_t st = clock();
//    while(clock() - st < 3.0 * CLOCKS_PER_SEC){
//
//    }
    
    
    
    
    
    
    return 0;
}


Measured memory_bytes: 512