#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i32 = int32_t;
using i64 = int64_t;
constexpr char newl = '\n';

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
//#define F first
//#define S second
#define debug(x) cout << #x << ": " << x << '\n';
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
const double eps = 1e-10;

template<typename T>
constexpr T Abs(T a) {
  return a > 0 ? a : -a;
}

#if 1

template<class T>
struct Vector2D {
  T X, Y;

  constexpr double DistanceSqr(const Vector2D<T>& r) {
    double a = r.X - X, b = r.Y - Y;
    return a * a + b * b;
  }

  constexpr double Distance(const Vector2D<T>& r) {
    return sqrt(DistanceSqr(r));
  }

  Vector2D<T>& operator+=(const Vector2D<T>& r) {

    X += r.X;
    Y += r.Y;

    return *this;
  }

  friend Vector2D<T> operator+(Vector2D<T> l, const Vector2D<T>& r) {
    l += r;
    return l;
  }

  template<class N>
  Vector2D<T>& operator*=(const N& r) {

    X *= r;
    Y *= r;

    return *this;
  }

  template<class N>
  friend Vector2D<T> operator*(Vector2D<T> l, const N& r) {
    l *= r;
    return l;
  }

  template<class N>
  Vector2D<T>& operator/=(const N& r) {

    X /= r;
    Y /= r;

    return *this;
  }

  template<class N>
  friend Vector2D<T> operator/(Vector2D<T> l, const N& r) {
    l /= r;
    return l;
  }
};

template <class T>
struct Circle {
  T X = 0, Y = 0, R = 0;

  Circle(T x = 0, T y = 0, T r = 0) : X(x), Y(y), R(r) {}

  // 含むか
  bool DoesContain(const Vector2D<T>& p) const {
    T dx = p.X - X, dy = p.Y - Y;

    return dx * dx + dy * dy < R * R;
  }

  // 直線 ax+by+c との交点を取得する
  vector<Vector2D<T>> GetIntersectsWithLine(T a, T b, T c) const {
    T l = a * a + b * b;
    T k = a * X + b * Y + c;
    T d = l * R * R - k * k;
    if (d > 0) {
      T ds = sqrt(d);
      T apl = a / l, bpl = b / l;
      T xc = X - apl * k,yc = Y - bpl * k;
      T xd = bpl * ds, yd = apl * ds;
      return {
        {xc - xd, yc + yd},
        {xc + xd, yc - yd},
      };
    }
    else if (d == 0) {
      return { {X-a*k/l, Y-b*k/l} };
    }
    else {
      return {};
    }
  }

  // 交点の座標を求める
  // 0～2個。一方がもう一方を内包しているときは0個と判定される
  vector<Vector2D<T>> GetIntersects(const Circle<T>& r) const {

    // (x-a)^2+(y-b)^2 = r^2
    // (x-A)^2+(y-B)^2 = R^2

    // x^2 -2ax + a^2 + y^2 -2by + b^2 = r^2
    // 2Ax -2ax + a^2 - A^2 +2By -2by + b^2 - B^2 = r^2 - R^2
    // (2A-2a)x = (r+R)(r-R) - (a+A)(a-A) - (b+B)(b-B) - (2B-2b)y
    // x = ( (r+R)(r-R) + (A+a)(A-a) + (B+b)(B-b) + 2(b-B)y ) / (2A-2a)
    // ...
    // x = (By + c) / A
    // 
    T a = X - r.X, b = Y - r.Y;
    return GetIntersectsWithLine(a, b, 0.5 * ((R - r.R) * (R + r.R) - a * (X + r.X) - b * (Y + r.Y)));
  }

  // 与えられた複数の円のうち、最大でいくつが重なっているかを求める
  // 全て重なっていないとき 1
  // 多分 O(N^3)
  static int GetMaxIntersectCount(const vector<Circle<T>>& cs) {
    int result = 0;

    F0R(i, cs.size()) {
      int score;
      Vector2D<T> v;
      vector<Vector2D<T>> vs;

      // 中心点
      v = { cs[i].X, cs[i].Y };
      score = 1;
      F0R(j, cs.size()) {
        if (j == i) continue;
        if (cs[j].DoesContain(v)) score++;
      }
      chmax(result, score);

      // 交点
      FOR(j, i + 1, cs.size()) {
        vs = cs[i].GetIntersects(cs[j]);

        for (auto v : vs) {
          score = 2;
          F0R(k, cs.size()) {
            if (i == k || j == k) continue;
            if (cs[k].DoesContain(v)) score++;
          }
          chmax(result, score);
        }
      }
    }

    return result;
  }
};

// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, K;
  cin >> N >> K;

  using V2 = Vector2D<double>;

  vector<int> xs(N), ys(N);
  vector<int> cs(N);

  vector<Circle<double>> circles(N);

  F0R(i, N) {
    cin >> xs[i] >> ys[i] >> cs[i];
    circles[i].X = xs[i];
    circles[i].Y = ys[i];
  }

  double result = 1e20;

  // 時刻 T で K 枚の焼肉を焼くことができるか？
  auto check = [&](long double T) -> bool {
    F0R(i, N) {
      circles[i].R = T / cs[i];
    }

    return Circle<double>::GetMaxIntersectCount(circles) >= K;
  };

  // めぐる式二分探索
  double ok = 100.0 * 2000.0 * 2000.0 * 2.0;
  double ng = 0;
  if (check(0)) ok = 0;
  while (!check(ok)) {
    ng = ok;
    ok *= 2.0;
  }
  while (Abs(ok - ng) > 1e-8) {
    double m = (ok + ng) / 2;

    if (check(m)) {
      ok = m;
    }
    else {
      ng = m;
    }
  }

  cout << std::fixed << std::setprecision(15);
  cout << ok;
}
#endif


Measured memory_bytes: 256