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

using Point = complex<long double>;
const long double EPS = 1e-9;
long double crs(const Point& a, const Point& b) { return a.real() * b.imag() - a.imag() * b.real(); }
long double dot(const Point& a, const Point& b) { return a.real() * b.real() - a.imag() * b.imag(); }
int sig(long double x) { return (x > EPS) ? 1 : (x < -EPS) ? -1 : 0; }
enum CCW_RESULT { CCW = +1, CW = -1, BEHIND = +2, FRONT = -2, ON = 0 };
int ccw(Point a, Point b, Point c) {
  b -= a; c -= a;
  if (crs(b, c) > EPS) return CCW;
  if (crs(b, c) < -EPS) return CW;
  if (dot(b, c) < -EPS) return BEHIND;
  if (norm(b) + EPS < norm(c)) return FRONT;
  return ON;
}

Point operator*(const Point& a, const int& b) { return a * (long double)b; }
Point operator/(const Point& a, const int& b) { return a / (long double)b; }
bool operator<(const Point& a, const Point& b) {
  return (abs(a.real() > b.real()) > EPS ? a.real() < b.real() : a.imag() < b.imag()) ;
}

struct Line{
  Point A, B, V;
  bool str;
  Line(Point a, Point b) : Line(a, b, true) {}
  Line(Point a, Point b, bool x) : A(a), B(b), str(x) { V = B - A; }

  Point proj(Point P) { return A + dot(V, P - A) / norm(V) * V; }
  Point refl(Point P) { return P + (proj(P) - P) * 2; }
  long double dist(Point P) { return abs(P - proj(P)); }

  bool intersect(Point P) {
    int c = ccw(A, B, P);
    if (c == CCW || c == CW) return false;
    if (c == ON || str) return true;
    return false;
  }

  bool intersect(Line L) {
    if (!str && crs(A - L.A, L.V) * crs(B - L.A, L.V) > EPS)
      return false;
    if (!L.str && crs(L.A - A, V) * crs(L.B - A, V) > EPS)
      return false;
    return (crs(V, L.V) > EPS || crs(V, L.A - A) < EPS);
  }

  Point crosspoint(Line L) {
    long double X = crs(V, L.V);
    long double Y = crs(V, B - L.A);
    return L.A + Y / X * L.V;
  }
};

struct Circle{
  Point O;
  long double r;
  Circle(Point o = Point(), long double d = 0) : O(o), r(d) {}
  Circle(long double x, long double y, long double d = 0) : O(x, y), r(d) {}

  vector<Point> crosspoint(Line L) {
    long double dist = L.dist(O);
    if (sig(dist - r) > 0) return {};
    if (sig(dist - r) == 0) return {L.proj(O)};
    Point P = L.proj(O);
    Point dif = sqrt(r * r - dist * dist) * L.V / abs(L.V);
    return {P + dif, P - dif};
  }

  vector<Point> crosspoint(Circle C) {
    Point V = C.O - O;
    long double L = abs(V);
    if (L < EPS) return {};
    if (sig(r + C.r + L - max({r, C.r, L}) * 2) < 0) return {};
    long double x = (L * L + r * r - C.r * C.r) / (L * 2);
    Point mid = O + V * (x / L);
    if (abs(x) > r) return {mid};
    Point dif = V * Point(0, 1) * sqrt(r * r - x * x) / L;
    if (abs(dif) < EPS) return {mid};
    return {mid + dif, mid - dif};
  }

  int in(Point P) {
    long double dist = abs(P - O);
    if (sig(r - dist) > 0) return 1;
    if (sig(r - dist) < 0) return 0;
    return 2;
  }
};

int main() {
  int N, K;
  cin >> N >> K;
  vector<Point> P;
  vector<Circle> Meet;
  vector<int> c(N);
  rep(i, N) {
    int x, y;
    cin >> x >> y >> c[i];
    P.emplace_back(x, y);
    Meet.emplace_back(P[i], 0);
  }

  long double ok = 1e9;
  long double ng = 0;

  rep(loop, 100) {
    long double mid = (ok + ng) / 2;
    rep(i, N) Meet[i].r = mid / c[i];
    vector<Point> cross = P;
    rep(a, N) rep(b, N) {
      if (a <= b) continue;
      vector<Point> res = Meet[a].crosspoint(Meet[b]);
      for (auto x : res) cross.push_back(x);
    }

    bool check = false;
    for (auto P : cross) {
      int cnt = 0;
      rep(i, N) if (Meet[i].in(P) > 0) cnt++;
      if (cnt >= K) check = true;
    }

    if (check) ok = mid;
    else ng = mid;
  }

  cout << fixed << setprecision(10);
  cout << ok << endl;
}

Measured memory_bytes: 476