#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

using point = complex<double>;

constexpr double eps = 1e-8;

// 円の交点
vector<point> kouten(point p, double s, point q, double t) {
  double d = abs(p - q);
  if (d >= s + t - eps) return {};
  double theta = acos((s * s + d * d - t * t) / (2 * s * d));
  point e = (q - p) / abs(q - p);
  point res1 = p + e * polar(s, theta);
  point res2 = p + e * polar(s, -theta);
  return {res1, res2};
}

int main() {
  int N, K; cin >> N >> K;
  vector<double> X(N), Y(N), C(N);
  rep(i, N) cin >> X[i] >> Y[i] >> C[i];
  double l = 0;
  double r = 1e7;
  rep(ii, 100) {
    double m = (l + r) / 2;
    int mx = 0;
    vector<point> cand;
    rep(i, N) cand.push_back(point(X[i], Y[i]));
    rep(i, N) rep(j, i) {
      for (point p : kouten(point(X[i], Y[i]), m / C[i], point(X[j], Y[j]), m / C[j])) {
        cand.push_back(p);
      }
    }
    for (point p : cand) {
      int cnt = 0;
      rep(i, N) {
        point q(X[i], Y[i]);
        if (abs(p - q) <= m / C[i] + eps) {
          cnt++;
        }
      }
      mx = max(mx, cnt);
    }
    if (mx >= K) {
      r = m;
    } else {
      l = m;
    }
  }
  cout << fixed << setprecision(15) << l << endl;
}