#include <bits/stdc++.h>
using namespace std;
const double PI = 3.14159265358979323;
struct Point {
  double x, y;
  Point(double x_ = 0, double y_ = 0) : x(x_), y(y_) {}
  Point(const Point &p) : x(p.x), y(p.y) {}
  friend std::ostream &operator<<(std::ostream &s, const Point &p) {
    return s << '(' << p.x << ", " << p.y << ')';
  }
};
inline Point operator+(const Point &p, const Point &q) {
  return Point(p.x + q.x, p.y + q.y);
}
inline Point operator-(const Point &p, const Point &q) {
  return Point(p.x - q.x, p.y - q.y);
}
inline Point operator*(const Point &p, double a) {
  return Point(p.x * a, p.y * a);
}
inline Point operator*(double a, const Point &p) {
  return Point(a * p.x, a * p.y);
}
inline Point operator/(const Point &p, double a) {
  return Point(p.x / a, p.y / a);
}
inline Point rot(const Point &p, double ang) {
  return Point(cos(ang) * p.x - sin(ang) * p.y,
               sin(ang) * p.x + cos(ang) * p.y);
}
inline double cross(const Point &p, const Point &q) {
  return p.x * q.y - p.y * q.x;
}
inline double dot(const Point &p, const Point &q) {
  return p.x * q.x + p.y * q.y;
}
inline double norm(const Point &p) { return sqrt(dot(p, p)); }
inline double norm_sqrd(const Point &p) { return dot(p, p); }
struct Circle : Point {
  double r;
  Circle(const Point &p_, double r_ = 0) : Point(p_), r(r_) {}
  friend ostream &operator<<(ostream &s, const Circle &c) {
    return s << '(' << c.x << ", " << c.y << ", " << c.r << ')';
  }
};
std::vector<Point> crosspoint(const Circle &e, const Circle &f,
                              const double eps) {
  std::vector<Point> res;
  double d = norm(e - f);
  if (d < eps) return vector<Point>();
  if (d > e.r + f.r + eps) return vector<Point>();
  if (d < abs(e.r - f.r) - eps) return vector<Point>();
  double rcos = (d * d + e.r * e.r - f.r * f.r) / (2.0 * d), rsin;
  if (e.r - abs(rcos) < eps)
    rsin = 0;
  else
    rsin = sqrt(e.r * e.r - rcos * rcos);
  Point dir = (f - e) / d;
  Point p1 =
      e + Point(dir.x * rcos - dir.y * rsin, dir.x * rsin + dir.y * rcos);
  Point p2 =
      e + Point(dir.x * rcos + dir.y * rsin, dir.x * -rsin + dir.y * rcos);
  res.push_back(p1);
  if (norm(p1 - p2) > eps) res.push_back(p2);
  return res;
}
void recursive_comb(int *indexes, int s, int rest,
                    std::function<void(int *)> f) {
  if (rest == 0) {
    f(indexes);
  } else {
    if (s < 0) return;
    recursive_comb(indexes, s - 1, rest, f);
    indexes[rest - 1] = s;
    recursive_comb(indexes, s - 1, rest - 1, f);
  }
}
void foreach_comb(int n, int k, std::function<void(int *)> f) {
  int indexes[k];
  recursive_comb(indexes, n - 1, k, f);
}
struct Niku {
  Niku() : p(Point()), c(0) {}
  Niku(const Point p_, const int c_) : p(p_), c(c_) {}
  int c;
  Point p;
};
bool lower_bound_f(double k, double &x, double l_x, double r_x, double eps,
                   function<double(double)> f) {
  long l_val = f(l_x);
  long r_val = f(r_x);
  if (l_val >= k || r_val < k) return false;
  while (abs(r_x - l_x) > eps) {
    x = (l_x + r_x) / 2;
    long val = f(x);
    if (val >= k) {
      r_x = x;
      r_val = val;
    } else {
      l_x = x;
      l_val = val;
    }
  }
  return true;
}
int main() {
  int n, k;
  cin >> n >> k;
  std::vector<Niku> niku_list(n);
  for (int i = 0; i < n; i++) {
    int x, y, c;
    cin >> x >> y >> c;
    niku_list[i] = Niku(Point(x, y), c);
  }
  if (k == 1) {
    cout << 0 << endl;
    return 0;
  }
  double t = 1e-2;
  lower_bound_f(k, t, 1e-2, 10000000, 1e-6, [&](double val) -> double {
    int max = 0;
    foreach_comb(n, 2, [&](int *indexes) {
      auto niku1 = niku_list[indexes[0]];
      auto niku2 = niku_list[indexes[1]];
      auto c1 = Circle(niku1.p, val / niku1.c);
      auto c2 = Circle(niku2.p, val / niku2.c);
      auto ps = crosspoint(c1, c2, 1e-7);
      for (int c = 0; c < ps.size(); c++) {
        int cnt = 0;
        for (int i = 0; i < n; i++) {
          if (i == indexes[0] || i == indexes[1]) {
            cnt++;
            continue;
          }
          double ndst = norm(niku_list[i].p - ps[c]);
          double nr = val / niku_list[i].c;
          if (ndst <= nr) cnt++;
        }
        if (cnt > max) max = cnt;
      }
    });
    return max;
  });
  printf("%.6f\n", t);
}
