#include <bits/stdc++.h>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/adaptor/indexed.hpp>

using namespace std;
using namespace boost::adaptors;
using namespace std::string_literals;
using ll = int64_t;
using vecint = vector<int>;
using vecll = vector<ll>;
using boost::irange;

using ld = long double;
using P = complex<ld>;
using VP = vector<P>;
const ld eps = 1e-8, pi = acos(-1.0);

#define EQ(a,b) (abs((a)-(b))<eps)

ld dot (P a, P b) { return real(conj(a) * b); }
ld cross (P a, P b) { return imag(conj(a) * b); }

namespace std {
  bool operator<(const P &lhs, const P &rhs) {
    return lhs.real() == rhs.real() ? lhs.imag() < rhs.imag()
                                    : lhs.real() < rhs.real();
  }
}

struct L{ P a, b; };
struct C { P p; ld r; };

// counter clockwise
int ccw (P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > eps) return 1;   // counter clockwise
  if (cross(b, c) < -eps) return -1; // clockwise
  if (dot(b, c) < 0) return 2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line
  return 0;                          // a--c--b on line
}
// Intersect

bool isis_ll(L l, L m) {
  return abs(cross(l.b - l.a, m.b - m.a)) > eps;
}

bool isis_ls(L l, L s) {
  ld a = cross(l.b - l.a, s.a - l.a);
  ld b = cross(l.b - l.a, s.b - l.a);
  return (a * b < eps);
}

bool isis_lp(L l, P p) {
  return abs(cross(l.b - p, l.a - p)) < eps;
}

bool isis_ss(L s, L t) {
  return ccw(s.a, s.b, t.a) * ccw(s.a, s.b, t.b) <= 0 &&
         ccw(t.a, t.b, s.a) * ccw(t.a, t.b, s.b) <= 0;
}

bool isis_sp(L s, P p) {
  return abs(s.a - p) + abs(s.b - p) - abs(s.b - s.a) < eps;
}

P proj(L l, P p) {
  ld t = dot(p - l.a, l.a - l.b) / norm(l.a - l.b);
  return l.a + t * (l.a - l.b);
}

P mirror(L l, P p) {
  return (ld)2 * proj(l, p) - p;
}

P is_ll(L s, L t){
  P sv = s.b - s.a, tv = t.b - t.a;
  return s.a + sv * cross(tv, t.a - s.a) / cross(tv, sv);
}

ld dist_lp(L l, P p) {
  return abs(p - proj(l, p));
}

ld dist_ll(L l, L m) {
  return isis_ll(l, m) ? 0 : dist_lp(l, m.a);
}

ld dist_ls(L l, L s) {
  if (isis_ls(l, s)) return 0;
  return min(dist_lp(l, s.a), dist_lp(l, s.b));
}

ld dist_sp(L s, P p) {
  P r = proj(s, p);
  if (isis_sp(s, r)) return abs(r - p);
  return min(abs(s.a - p), abs(s.b - p));
}

ld dist_ss(L s, L t) {
  if (isis_ss(s, t)) return 0;
  ld a = min(dist_sp(s, t.a), dist_sp(t, s.a));
  ld b = min(dist_sp(s, t.b), dist_sp(t, s.b));
  return min(a, b);
}

VP is_cc(C c1, C c2){
  VP res;
  ld d = abs(c1.p - c2.p);
  ld rc = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d);
  ld dfr = c1.r * c1.r - rc * rc;
  if (abs(dfr) < eps) dfr = 0.0;
  else if (dfr < 0.0) return res; // no intersection
  ld rs = sqrt(dfr);
  P diff = (c2.p-c1.p)/d;
  res.push_back(c1.p + diff * P(rc, rs));
  if (dfr != 0.0) res.push_back(c1.p + diff * P(rc, -rs));
  return res;
}

int main()
{
  int n,k;
  cin>>n>>k;
  VP vp(n);
  vector<double> vc(n);
  for(auto&& i:irange(0,n)) {
    double x,y,c;
    cin>>x>>y>>c;
    vp[i] = P(x,y);
    vc[i] = c;
  }
  double hi = 4000*100;
  double lo = 0;
  for (auto&& lp:irange(0,100)) {
    double mid = (hi+lo) / 2;
    VP candi;
    for(auto&& i:irange(0,n)) {
      double ri = mid / vc[i];
      candi.push_back(vp[i]);
      for(auto&& j:irange(0,i)) {
        double rj = mid / vc[j];
        auto tmp = is_cc(C{vp[i],ri}, C{vp[j],rj});
        candi.insert(end(candi),begin(tmp),end(tmp));
      }
    }
    bool ok = false;
    for(auto&& p:candi) {
      int cntv = 0;
      for(auto&& i:irange(0,n)) {
        double ri = mid / vc[i];
        if (abs(p - vp[i]) < ri + eps) ++cntv;
      }
      if (cntv >= k) ok = true;
    }
    if (ok) {
      hi = mid;
    } else {
      lo = mid;
    }
  }
  cout<<fixed<<setprecision(10)<<hi<<endl;
  return 0;
}


Measured memory_bytes: 512