#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <cassert>
#include <bitset>

//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;

//std::cout << std::fixed << std::setprecision(10)
//std::ios::sync_with_stdio(false);
//constexpr long long MOD = 1000000007;

int dx[] = { 0, 1, 0, -1};
int dy[] = {-1, 0, 1,  0};

constexpr double eps = 1e-9;
bool equal(double x, double y)
{
  return std::abs(x - y) < eps;
}

struct Point
{
  double x, y;
};
Point operator+(const Point& a, const Point& b)
{
  return Point{a.x + b.x, a.y + b.y};
}
Point operator-(const Point& a, const Point& b)
{
  return Point{a.x - b.x, a.y - b.y};
}
Point operator*(double c, const Point& a)
{
  return Point{c*a.x, c*a.y};
}
Point operator*(const Point& a, double c)
{
  return Point{c*a.x, c*a.y};
}
Point rotate90(const Point& p)
{
  return Point{-p.y, p.x};
}
Point reverseRotate90(const Point& p)
{
  return Point{p.y, -p.x};
}
double distance(const Point& p1, const Point& p2)
{
  return std::sqrt(std::pow(p1.x - p2.x, 2) + std::pow(p1.y - p2.y, 2));
}

struct Circle
{
  Point c;
  double r;
};
std::vector<Point> getIntersections(const Circle& c1, const Circle& c2)
{
  double d = distance(c1.c, c2.c);
  double sum = d + c1.r + c2.r;
  double max = std::max(d, std::max(c1.r, c2.r));
  if(equal(d, 0))
    return {};
  double x = (c1.r*c1.r+d*d-c2.r*c2.r)/(2*d);
  if(equal(sum, 2 * max))
  {
    return {c1.c+(c2.c-c1.c)*(x/d)};
  }
  if(sum < 2 * max)
    return std::vector<Point>{};
  double y = std::sqrt(c1.r*c1.r-x*x);
  std::vector<Point> ans(2);
  ans[0] = c1.c + (c2.c-c1.c)*(x/d) + rotate90(c2.c-c1.c)*(y/d);
  ans[1] = c1.c + (c2.c-c1.c)*(x/d) + reverseRotate90(c2.c-c1.c)*(y/d);
  return ans;
}

int main()
{
  int N, K;
  std::cin >> N >> K;
  std::vector<Point> points;
  std::vector<double> cs;
  for(int i = 0; i < N; ++i)
  {
    double x, y, c;
    std::cin >> x >> y >> c;
    points.push_back(Point{x, y});
    cs.push_back(c);
  }
  double l = 0, r = 400000;
  std::size_t cnt = 1000;
  std::vector<Circle> circles;
  std::vector<Point> candidates;
  circles.reserve(N);
  while(cnt--)
  {
    double t = l + (r - l)/2;
    circles.clear();
    candidates.clear();
    for(int i = 0; i < N; ++i)
    {
      circles.push_back(Circle{points[i], t/cs[i]});
      candidates.push_back(circles[i].c);
    }
    for(int i = 0; i < N; ++i)
    {
      for(int j = i + 1; j < N; ++j)
      {
        auto tmp = getIntersections(circles[i], circles[j]);
        candidates.insert(candidates.end(), tmp.begin(), tmp.end());
      }
    }
    bool ans = false;
    for(auto& p: candidates)
    {
      size_t n = 0;
      for(auto& c: circles)
      {
        if(distance(c.c, p) < c.r + eps)
          ++n;
      }
      if(K <= n)
      {
        ans = true;
        break;
      }
    }
    if(ans)
      r = t;
    else
      l = t;
  }
  std::cout << std::fixed << std::setprecision(10) << r << std::endl;
  return 0;
}



Measured memory_bytes: 384