#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using pii = pair<int,int>;

const double eps = 1e-9;

template <class T> int sgn(T x) { return (x > 0) - (x < 0); }
template<class T>
struct Point {
	typedef Point P;
	T x, y;
	explicit Point(T x=0, T y=0) : x(x), y(y) {}
	bool operator<(P p) const { return tie(x,y) < tie(p.x,p.y); }
	bool operator==(P p) const { return tie(x,y)==tie(p.x,p.y); }
	P operator+(P p) const { return P(x+p.x, y+p.y); }
	P operator-(P p) const { return P(x-p.x, y-p.y); }
	P operator*(T d) const { return P(x*d, y*d); }
	P operator/(T d) const { return P(x/d, y/d); }
	T dot(P p) const { return x*p.x + y*p.y; }
	T cross(P p) const { return x*p.y - y*p.x; }
	T cross(P a, P b) const { return (a-*this).cross(b-*this); }
	T dist2() const { return x*x + y*y; }
	double dist() const { return sqrt((double)dist2()); }
	// angle to x-axis in interval [-pi, pi]
	double angle() const { return atan2(y, x); }
	P unit() const { return *this/dist(); } // makes dist()=1
	P perp() const { return P(-y, x); } // rotates +90 degrees
	P normal() const { return perp().unit(); }
	// returns point rotated 'a' radians ccw around the origin
	P rotate(double a) const {
		return P(x*cos(a)-y*sin(a),x*sin(a)+y*cos(a)); }
	friend ostream& operator<<(ostream& os, P p) {
		return os << "(" << p.x << "," << p.y << ")"; }
};

typedef Point<double> P;
bool circleInter(P a,P b,double r1,double r2,pair<P, P>* out) {
	if (a == b) { assert(r1 != r2); return false; }
	P vec = b - a;
	double d2 = vec.dist2(), sum = r1+r2, dif = r1-r2,
	       p = (d2 + r1*r1 - r2*r2)/(d2*2), h2 = r1*r1 - p*p*d2;
	if (sum*sum < d2 || dif*dif > d2) return false;
	P mid = a + vec*p, per = vec.perp() * sqrt(fmax(0, h2) / d2);
	*out = {mid + per, mid - per};
	return true;
}

struct Circle {
  P o; double r;
  Circle(P o=P(), double r=0) : o(o), r(r) {}
//   vector<P> crossPoint(const Circle& c) {
//     V v = c.o-o;
//     double l = v.norm();
//     if (equal(l, 0)) return {};
//     if (equal(l+r+c.r, max({l,r,c.r})*2)) {
//       if (equal(l+r,c.r)) return {o - v*(r/l)};
//       return {o + v*(r/l)};
//     }
//     if (l+r+c.r < max({l,r,c.r})*2) return {};
//     double x = (l*l + r*r - c.r*c.r) / (2*l);
//     double y = sqrt(r*r - x*x);
//     P mid = o + v*(x/l);
//     v = v.rotate90();
//     return {mid + v*(y/l), mid - v*(y/l)};
//   }
  bool isInside(const P& p) const {
    return (p-o).dist() < r+eps;
  }
};

int n, k;

int main() {
  cin >> n >> k;
  vector<Circle> c(n);
  rep(i,n) cin >> c[i].o.x >> c[i].o.y >> c[i].r;

  double l = 0, r = 400000;
  rep(_, 100) {
    double x = (l + r)/2;
    vector<P> ps;
    rep(i,n) ps.push_back(c[i].o);
    rep(i,n) rep(j,i) {
      Circle a = c[i], b = c[j];
      a.r = x/a.r;
      b.r = x/b.r;
      pair<P,P> out;
      bool intersects = circleInter(a.o, b.o, a.r, b.r, &out);
      if (!intersects) continue;
      ps.push_back(out.first);
      ps.push_back(out.second);
    }
    bool ok = false;
    for (P p : ps) {
      int cnt = 0;
      rep(ci,n) {
        Circle nc = c[ci];
        nc.r = x/nc.r;
        if (nc.isInside(p)) cnt++;
      }
      if (cnt >= k) ok = true;
    }
    if ( ok ) r = x; else l = x;
  }
  printf("%.10f\n", r);
  return 0;
}

Measured memory_bytes: 3920