#include <bits/stdc++.h>
using namespace std;
const double INF = 1e100;
pair<pair<double, double>, pair<double, double>> circle_cross_point(
    double x0, double y0, double r0, double x1, double y1, double r1) {
  if ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0) > (r0 + r1) * (r0 + r1) ||
      (x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0) < (r0 - r1) * (r0 - r1)) {
    return pair<pair<double, double>, pair<double, double>>(
        pair<double, double>(INF, INF), pair<double, double>(INF, INF));
  }
  double a =
      ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0) + r0 * r0 - r1 * r1) / 2;
  double z = ((x1 - x0) * (x1 - x0) + (y1 - y0) * (y1 - y0));
  return pair<pair<double, double>, pair<double, double>>(
      pair<double, double>(
          (a * (x1 - x0) + (y1 - y0) * sqrt(z * r0 * r0 - a * a)) / z + x0,
          (a * (y1 - y0) - (x1 - x0) * sqrt(z * r0 * r0 - a * a)) / z + y0),
      pair<double, double>(
          (a * (x1 - x0) - (y1 - y0) * sqrt(z * r0 * r0 - a * a)) / z + x0,
          (a * (y1 - y0) + (x1 - x0) * sqrt(z * r0 * r0 - a * a)) / z + y0));
}
int main() {
  int n, k;
  cin >> n >> k;
  double x[100], y[100], c[100];
  for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> c[i];
  double left = 0, right = 1e18;
  while (right - left > right * 1e-9) {
    double mid = (right + left) / 2;
    bool f = false;
    for (int i = 0; i < n; i++) {
      int d = 0;
      for (int j = 0; j < n; j++) {
        if ((x[j] - x[i]) * (x[j] - x[i]) + (y[j] - y[i]) * (y[j] - y[i]) -
                right * 1e-9 <
            (mid / c[j]) * (mid / c[j]))
          d++;
      }
      if (d >= k) f = true;
    }
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        pair<pair<double, double>, pair<double, double>> p =
            circle_cross_point(x[i], y[i], mid / c[i], x[j], y[j], mid / c[j]);
        double u = p.first.first, v = p.first.second;
        int d = 0;
        for (int l = 0; l < n; l++) {
          if ((x[l] - u) * (x[l] - u) + (y[l] - v) * (y[l] - v) - right * 1e-9 <
              (mid / c[l]) * (mid / c[l]))
            d++;
        }
        if (d >= k) f = true;
        u = p.second.first, v = p.second.second;
        d = 0;
        for (int l = 0; l < n; l++) {
          if ((x[l] - u) * (x[l] - u) + (y[l] - v) * (y[l] - v) -
                  right * 1e-10 <
              (mid / c[l]) * (mid / c[l]))
            d++;
        }
        if (d >= k) f = true;
      }
    }
    if (f)
      right = mid;
    else
      left = mid;
  }
  cout << fixed << setprecision(15) << right << endl;
}
