/**
 * @brief ユーザ定義リテラル
 * @author えびちゃん
 */

#ifndef H_int_literals
#define H_int_literals

#include <cstddef>
#include <cstdint>

constexpr intmax_t  operator ""_jd(unsigned long long n) { return n; }
constexpr uintmax_t operator ""_ju(unsigned long long n) { return n; }
constexpr size_t    operator ""_zu(unsigned long long n) { return n; }
constexpr ptrdiff_t operator ""_td(unsigned long long n) { return n; }

#endif  /* !defined(H_int_literals) */

#include <cstdio>
#include <cstdint>
#include <algorithm>
#include <complex>
#include <numeric>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using point = std::complex<long double>;
using circle = std::pair<point, long double>;

constexpr long double eps = 1e-8;

std::vector<point> intersection(circle z1, circle z2) {
  point p1, p2;
  long double r1, r2;
  std::tie(p1, r1) = z1;
  std::tie(p2, r2) = z2;
  if (!(r1 <= r2)) {
    std::swap(p1, p2);
    std::swap(r1, r2);
    std::swap(z1, z2);
  }

  long double d = std::abs(p1-p2);

  if (r1+r2+eps < d) {
    // 4
    // fprintf(stderr, "4\n");
    return {};
  }

  if (std::abs(r1+r2-d) < eps) {
    // 3
    // fprintf(stderr, "3\n");
    return {(p1*r2 + p2*r1) / (r1+r2)};
  }

  if (std::abs(r2-r1-d) < eps) {
    // 1
    // fprintf(stderr, "1\n");
    return {(p1*r2 - p2*r1) / (r2-r1)};
  }

  if (r2-r1 > d+eps) {
    // 0
    // fprintf(stderr, "0\n");
    return {};
  }

  // 2
  {
    long double x1 = p1.real();
    long double y1 = p1.imag();
    long double x2 = p2.real();
    long double y2 = p2.imag();
    long double l = std::sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
    long double t1 = std::atan2(y2-y1, x2-x1);
    long double t2 = std::acos((l*l + r1*r1 - r2*r2) / (2*l*r1));
    point res1 = point(x1 + r1 * std::cos(t1+t2), y1 + r1 * std::sin(t1+t2));
    point res2 = point(x1 + r1 * std::cos(t1-t2), y1 + r1 * std::sin(t1-t2));
    return {res1, res2};
  }
}

size_t f(std::vector<circle> const& z, size_t k) {
  size_t n = z.size();
  std::vector<point> cand;
  for (size_t i = 0; i < n; ++i) {
    for (size_t j = 0; j < i; ++j) {
      // fprintf(stderr, "int(%zu, %zu)\n", i, j);
      auto tmp = intersection(z[i], z[j]);
      // for (auto const& p: tmp)
      //   fprintf(stderr, "  (%.12Lf, %.12Lf)\n", p.real(), p.imag());
      cand.insert(cand.end(), tmp.begin(), tmp.end());
    }
    cand.push_back(z[i].first);
  }

  for (auto const& cc: cand) {
    // fprintf(stderr, "(%.12Lf, %.12Lf)\n", cc.real(), cc.imag());
    size_t cur = 0;
    for (auto const& zi: z) {
      if (std::abs(cc-zi.first) - eps < zi.second) ++cur;
    }
    if (cur >= k) return true;
  }
  return false;
}

int main() {
  size_t n, k;
  scanf("%zu %zu", &n, &k);

  std::vector<int> x(n), y(n), c(n);
  for (size_t i = 0; i < n; ++i)
    scanf("%d %d %d", &x[i], &y[i], &c[i]);

  long double lb = 0;
  long double ub = 1e9;
  for (int i = 0; i < 70; ++i) {
    long double mid = 0.5L * (lb+ub);
    // fprintf(stderr, "mid: %.12Lf\n", mid);
    std::vector<circle> z(n);
    for (size_t j = 0; j < n; ++j) {
      z[j].first = point(x[j], y[j]);
      z[j].second = mid / c[j];
    }
    ((f(z, k))? ub: lb) = mid;
  }
  printf("%.16Lf\n", ub);
}


Measured memory_bytes: 464