#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <deque>
#include <fstream>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
#include <complex>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 0> { using type = T; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
template <class T> inline void chmin(T &a, const T& b) { if (b < a) a = b; }
template <class T> inline void chmax(T &a, const T& b) { if (b > a) a = b; }
/* clang-format on */

typedef complex<double> point;
namespace std {
bool operator < (point p, point q) {
  if (real(p) != real(q)) return real(p) < real(q);
  return imag(p) < imag(q);
}
};
double dot(point p, point q)   { return real(conj(p) * q); }
double cross(point p, point q) { return imag(conj(p) * q); }
double EPS = 1e-8;
int sign(double x) {
  if (x < -EPS) return -1;
  if (x > +EPS) return +1;
  return 0;
}

struct circle { 
  point p; double r;
  bool contains(point p) const {
    return sign(abs(this->p - p) - r) <= 0;
  }
};
struct line { point p, q; };

vector<point> intersect(circle C, circle D) {
  double d = abs(D.p - C.p);
  if (sign(d - C.r - D.r) > 0) return {};       // too far
  if (sign(d - abs(C.r - D.r)) <= 0) return {}; // too close
  double a = (C.r*C.r - D.r*D.r + d*d)/(2*d);
  double h = sqrt(C.r*C.r - a*a);
  point v = (D.p - C.p) / d;
  if (sign(h) == 0) return {C.p + v*a};         // touch
  return {C.p + v*a + point(0,1)*v*h,           // intersect
          C.p + v*a - point(0,1)*v*h};
}

int main() {
#ifdef DEBUG
  ifstream ifs("in.txt");
  cin.rdbuf(ifs.rdbuf());
#endif
  int N, K;
  while (cin >> N >> K) {
    vector<double> x(N), y(N), c(N);
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i] >> c[i];
    vector<point> points;
    for (int i = 0; i < N; i++) points.push_back(point{ x[i], y[i] });
    auto check = [&](double T) {
      vector<circle> circles;
      for (int i = 0; i < N; i++) circles.push_back(circle{ points[i], T / c[i] });
      vector<point> cand;
      for (int i = 0; i < N; i++) cand.push_back(points[i]);
      for (int i = 0; i < N; i++) {
        for (int j = i + 1; j < N; j++) {
          for (auto p : intersect(circles[i], circles[j])) {
            cand.push_back(p);
          }
        }
      }
      for (auto p : cand) {
        int cnt = 0;
        for (int i = 0; i < N; i++) {
          cnt += circles[i].contains(p);
        }
        if (cnt >= K) return true;
      }
      return false;
    };
    double fail = 0, pass = 1e9;
    for (int i = 0; i < 100; i++) {
      double T = (fail + pass) / 2;
      if (check(T)) {
        pass = T;
      } else {
        fail = T;
      }
    }
    printf("%.20f\n", pass);
  }
  return 0;
}


Measured memory_bytes: 384