#include <bits/stdc++.h>

template <typename T>
struct Vector {
  T x, y;
  T Norm() const { return std::sqrt(x * x + y * y); }
  Vector& operator+=(const Vector& v) {
    (*this).x += v.x;
    (*this).y += v.y;
    return *this;
  }
  Vector operator+(const Vector& v) const { return Vector(*this) += v; }
  Vector& operator-=(const Vector& v) {
    (*this).x -= v.x;
    (*this).y -= v.y;
    return *this;
  }
  Vector operator-(const Vector& v) const { return Vector(*this) -= v; }
  Vector& operator*=(T t) {
    (*this).x *= t;
    (*this).y *= t;
    return *this;
  }
  Vector operator*(T t) const { return Vector(*this) *= t; }
  bool operator<(const Vector& v) const {
    if (x != v.x) {
      return x < v.x;
    }
    return y < v.y;
  }
  Vector Rot90() const { return {-y, x}; }

  // TODO:
  // * Rename this struct to Point and add method that treats this struct as
  //   a 2D vector (e.g., dot product) and as a complex number (arc, multiple
  //   number multiplication, ...).
  //   Check the STL functions:
  //   https://ja.cppreference.com/w/cpp/numeric/complex Check the wikipedia
  //   page: https://en.wikipedia.org/wiki/Complex_number
  // * Replace Rot90 with more generic Rotate(arg) function.
  // * Think about a way to visualize these objects for debugging. One idea is
  //   to add an external library that renders these objects using Cairo.
  //   For visualization, WolframAlpha is also extremely useful, for example it
  //   even calculates intersections if provided 2 circles. Try:
  //   (x-1)^2+y^2=5^2, (x+7)^2+y^2=3^2
  // * Add common constants like pi.
};

template <typename T>
std::istream& operator>>(std::istream& is, Vector<T>& v) {
  is >> v.x >> v.y;
  return is;
}

template <typename T>
std::ostream& operator<<(std::ostream& os, const Vector<T>& v) {
  os << "(" << v.x << "," << v.y << ")";
  return os;
}

template <typename T>
struct Circle {
  using V = Vector<T>;
  V center;
  double radius;

  std::vector<V> Intersections(const Circle& c) const {
    // TODO: Handle cases where there is no intersection and there is only one
    // intersection.
    auto sq = [](T x) -> T { return x * x; };
    V v = c.center - center;
    T l = v.Norm();
    if (l >= radius + c.radius || (l + radius) <= c.radius ||
        (l + c.radius) <= radius) {
      return {};
    }
    T x = (sq(radius) - sq(c.radius) + sq(l)) / (2 * l);
    T a = std::sqrt(sq(radius) - sq(x));
    V perpendicular_foot = v * (x / l);
    V perpendicular = v.Rot90() * (a / l);
    return {center + perpendicular_foot + perpendicular,
            center + perpendicular_foot - perpendicular};
  }

  // TODO: Add Contains method that checks if a point is contained in the
  // circle. That function should use EPS on check to take into account the
  // computation error. Proabbly this library should also provide a commom EPS
  // value (or provide utility functions that uses EPS inside of it).
};

const double pi = acos(-1);

#if DEBUG
template <typename T>
void debug(const T& value) {
  std::cerr << value;
}
template <typename T, typename... Ts>
void debug(const T& value, const Ts&... args) {
  std::cerr << value << ", ";
  debug(args...);
}
#define dbg(...)                        \
  do {                                  \
    cerr << #__VA_ARGS__ << ": ";       \
    debug(__VA_ARGS__);                 \
    cerr << " (L" << __LINE__ << ")\n"; \
  } while (0)
#else
#define dbg(...)
#endif

void read_from_cin() {}
template <typename T, typename... Ts>
void read_from_cin(T& value, Ts&... args) {
  std::cin >> value;
  read_from_cin(args...);
}
#define rd(type, ...) \
  type __VA_ARGS__;   \
  read_from_cin(__VA_ARGS__);

template <typename T>
void write_to_cout(const T& value) {
  std::cout << value << '\n';
}
template <typename T, typename... Ts>
void write_to_cout(const T& value, const Ts&... args) {
  std::cout << value << ' ';
  write_to_cout(args...);
}
#define wt(...) write_to_cout(__VA_ARGS__);

#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using ll = long long;

template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = V<V<T>>;

using namespace std;

using Vec = Vector<double>;
using Circ = Circle<double>;

int N, K;
Vec p[60];
double c[60];

bool Ok(double t) {
  dbg(t);
  vector<Vec> vs(p, p + N);
  auto Rad = [t](int i) { return t / c[i]; };
  rep(i, N) rep(j, i) {
    Circ ci = {p[i], Rad(i)}, cj = {p[j], Rad(j)};
    dbg(ci.center, ci.radius, cj.center, cj.radius);
    for (auto& v : ci.Intersections(cj)) {
      dbg(v);
      vs.push_back(v);
    }
  }
  // dbg(t, vs.size());
  rep(i, vs.size()) {
    int contains = 0;
    rep(j, N) {
      // This 1e-10 was important.
      if (Rad(j) + 1e-10 > (vs[i] - p[j]).Norm()) ++contains;
    }
    dbg(t, i, vs[i], contains);
    if (contains >= K) {
      return true;
    }
  }
  return false;
}

int main() {
  cin >> N >> K;
  rep(i, N) cin >> p[i].x >> p[i].y >> c[i];

  // Initially lo was 0.1 for some reason, which resulted WA.
  double lo = 0, hi = 10000000;
  const double EPS = 1e-8;
  while (hi - lo > EPS) {
    double mid = (hi + lo) / 2;
    (Ok(mid) ? hi : lo) = mid;
  }
  cout << setprecision(20) << lo << endl;
}


Measured memory_bytes: 3880