#include <bits/stdc++.h>
using namespace std;
const long double pi = acos(-1);
const long double eps = 1e-9;
struct Point {
  long double x, y;
  Point() {}
  Point(long double x_, long double y_) {
    x = x_;
    y = y_;
  }
  Point rotate() const { return Point(-y, x); }
  Point normalize(long double len) const {
    long double c = sqrt(x * x + y * y);
    return Point(x * len / c, y * len / c);
  }
  Point operator+(const Point &other) const {
    return Point(x + other.x, y + other.y);
  }
  Point operator-(const Point &other) const {
    return Point(x - other.x, y - other.y);
  }
  long double dist(const Point &other) const {
    return hypot(x - other.x, y - other.y);
  }
};
int n, k;
vector<Point> p;
vector<long double> c;
vector<long double> r;
int ans = 0;
void relax(Point to) {
  int u = 0;
  for (int i = 0; i < n; i++) {
    if (p[i].dist(to) < r[i] + eps) u++;
  }
  ans = max(ans, u);
}
pair<Point, Point> inter(const Point &A, const Point &B, long double ra,
                         long double rb) {
  long double d = A.dist(B);
  long double a = (ra * ra - rb * rb + d * d) / 2 / d;
  long double h = sqrt(ra * ra - a * a + eps);
  Point v = B - A;
  Point u = v.rotate();
  v = v.normalize(a);
  u = u.normalize(h);
  Point H = A + v;
  return {H - u, H + u};
}
void solve() {
  ans = 0;
  for (int i = 0; i < n; i++) {
    for (int j = i + 1; j < n; j++) {
      if (p[i].dist(p[j]) > r[i] + r[j] + eps) continue;
      if (p[i].dist(p[j]) < fabs(r[i] - r[j])) continue;
      auto t = inter(p[i], p[j], r[i], r[j]);
      relax(t.first);
      relax(t.second);
    }
    relax(p[i]);
  }
}
int check(long double t) {
  for (int i = 0; i < n; i++) {
    r[i] = t / c[i];
  }
  solve();
  return ans >= k;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(16);
  cin >> n >> k;
  p.resize(n);
  c.resize(n);
  r.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> p[i].x >> p[i].y >> c[i];
  }
  long double ll = 0;
  long double rr = 1e18 + 239;
  for (int i = 0; i < 1000; i++) {
    long double m = (rr + ll) / 2;
    if (check(m))
      rr = m;
    else
      ll = m;
  }
  cout << rr << endl;
}
