import Control.Monad
import Data.Maybe
import Data.List
import Text.Printf
import qualified Data.ByteString.Char8 as C

eps :: Double
eps = 1e-8

sign :: Double -> Int
sign x
  | x > eps = 1
  | x < (-eps) = -1
  | otherwise = 0

greaterEqual :: Double -> Double -> Bool
greaterEqual a b =
  case sign (a - b) of
    -1 -> False
    _ -> True

greater :: Double -> Double -> Bool
greater a b =
  case sign (a - b) of
    1 -> True
    _ -> False

data Point = Point Double Double
  deriving (Eq, Show)

len2 :: Point -> Point -> Double
len2 (Point x1 y1) (Point x2 y2) = (x1 - x2) ** 2 + (y1 - y2) ** 2

sub :: Point -> Point -> Point
sub (Point x1 y1) (Point x2 y2) = Point (x1 - x2) (y1 - y2)

dot :: Point -> Point -> Double
dot (Point x1 y1) (Point x2 y2) = x1 * x2 + y1 * y2

det :: Point -> Point -> Double
det (Point x1 y1) (Point x2 y2) = x1 * y2 - x2 * y1

angle :: Point -> Point -> Double
angle p1 p2 = atan2 (det p1 p2) (dot p1 p2)

type Circle = (Point, Double)
type Range = (Double, Double)

calcIntersection :: Circle -> Circle -> [Range]
calcIntersection (p1, r1) (p2, r2) = concat $ map calcRange calcAngle
  where
  d2 = len2 p1 p2
  d = sqrt d2
  a0 = angle (sub p2 p1) (Point 1 0)
  calcAngle
    | greater d2 ((r1 + r2) ** 2) = []
    | greaterEqual d2 ((r1 - r2) ** 2) = let as = acos $ (r1 * r1 + d2 - r2 * r2) / (2 * r1 * d) in
                                             [if as < 0 then pi + as else as]
    | r1 < r2 = [pi]
    | otherwise = []
  calcRange da
    | b < 0 && e < 0 = error (show a0 ++ " " ++ show da)
    | b > 2 * pi && e > 2 * pi = error (show a0 ++ " " ++ show da)
    | da == pi = [(0, 2 * pi)]
    | b < 0 = [(2 * pi + b, 2 * pi), (0, e)]
    | e > 2 * pi = [(b, 2 * pi), (0, e - 2 * pi)]
    | otherwise = [(b, e)]
    where
    a0' = if a0 < 0 then a0 + 2 * pi else a0
    b = a0' - da
    e = a0' + da

calcCover :: Double -> [Circle] -> Circle -> Int
calcCover t cs c = abs o'
  where
  c' = let (p0, r0) = c in (p0, r0 * t)
  cs' = map (\(p, r) -> (p, r * t)) $ filter ((/=)c) cs
  rs = concat $ map (calcIntersection c') cs'
  vs = sort $ concat $ map (\(l, r) -> [(l, -1), (r, 1)]) rs
  (_, o') = foldl' (\(a, o) (xx, da) -> if xx < 0 || xx > 2 * pi then error (show xx) else let a' = a + da in (a', min o a')) (0, 0) vs

main :: IO ()
main = do
  let readInts = fmap (map (fst . fromJust . C.readInt) . C.words) C.getLine
      toCircle xs =
        let [x', y', c'] = map fromIntegral xs
        in ((Point x' y'), (1.0 / c'))
  [n, k] <- readInts
  cs <- replicateM n $ fmap toCircle readInts
  let func (l, r) _ =
        let m = (l + r) * 0.5
            k' = maximum $ map (calcCover m cs) cs
        in if k' >= k - 1
             then (l, m)
             else (m, r)
      (ll, rr) = foldl' func (0, 300000) [1..100 :: Int]
  putStrLn $ printf "%.10f" ((ll + rr) * 0.5)
