package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var sc, wr = bufio.NewScanner(os.Stdin), bufio.NewWriter(os.Stdout)

func scanString() string   { sc.Scan(); return sc.Text() }
func scanRunes() []rune    { return []rune(scanString()) }
func scanInt() int         { a, _ := strconv.Atoi(scanString()); return a }
func scanInt64() int64     { a, _ := strconv.ParseInt(scanString(), 10, 64); return a }
func scanFloat64() float64 { a, _ := strconv.ParseFloat(scanString(), 64); return a }

func scanInts(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = scanInt()
	}
	return res
}

func debug(a ...interface{}) { fmt.Fprintln(os.Stderr, a...) }

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}
func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

//•*¨*•.¸¸♪main•*¨*•.¸¸♪(　-ω-)ノ　(　・ω・)
func main() {
	defer wr.Flush()
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 10000), 1001001)

	n, k := scanInt(), scanInt()
	x, y, c := make([]float64, n), make([]float64, n), make([]float64, n)
	for i := 0; i < n; i++ {
		x[i], y[i], c[i] = scanFloat64(), scanFloat64(), scanFloat64()
	}

	t1, t2 := 0., 1e6
	for t := 0; t < 100; t++ {
		m := (t1 + t2) / 2
		f := false
		ps := []point{}
		cs := make([]float64, n)
		for i := 0; i < n; i++ {
			cs[i] = m / c[i]
		}
		for i := 0; i < n; i++ {
			ps = append(ps, point{x[i], y[i]})
			c1 := circle{x[i], y[i], cs[i]}
			for j := 0; j < n; j++ {
				c2 := circle{x[j], y[j], cs[j]}
				ps = append(ps, ccIntersection(c1, c2)...)
			}
		}
		for _, p := range ps {
			cnt := 0
			for i := 0; i < n; i++ {
				if dist(p, point{x[i], y[i]}) <= cs[i]+eps {
					cnt++
				}
			}
			if cnt >= k {
				f = true
				break
			}
		}
		if f {
			t2 = m
		} else {
			t1 = m
		}
	}
	fmt.Fprintln(wr, t2)
}

const eps = 1e-8

type point struct{ x, y float64 }
type circle struct{ x, y, r float64 }

func dist(p1, p2 point) float64 {
	return math.Sqrt((p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y))
}

func circumcenter(a, b, c point) point {
	square := func(p1, p2 point) float64 {
		return (p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y)
	}
	aa := square(b, c)
	bb := square(c, a)
	cc := square(a, b)
	d := aa*(bb+cc-aa) + bb*(cc+aa-bb) + cc*(aa+bb-cc)
	x := (aa*(bb+cc-aa)*a.x + bb*(cc+aa-bb)*b.x + cc*(aa+bb-cc)*c.x) / d
	y := (aa*(bb+cc-aa)*a.y + bb*(cc+aa-bb)*b.y + cc*(aa+bb-cc)*c.y) / d

	return point{x, y}
}

func isStraight(a, b, c point) bool {
	square := func(p1, p2 point) float64 {
		return (p1.x-p2.x)*(p1.x-p2.x) + (p1.y-p2.y)*(p1.y-p2.y)
	}
	aa := square(b, c)
	bb := square(c, a)
	cc := square(a, b)
	if aa*(bb+cc-aa)+bb*(cc+aa-bb)+cc*(aa+bb-cc) < eps {
		return true
	}
	return false
}

func ccIntersection(c1, c2 circle) []point {
	res := []point{}
	d := math.Sqrt((c1.x-c2.x)*(c1.x-c2.x) + (c1.y-c2.y)*(c1.y-c2.y))
	if d < eps || c1.r+c2.r+eps < d || math.Abs(c1.r-c2.r) > d+eps {
		return []point{}
	}
	rc := (c1.r*c1.r + d*d - c2.r*c2.r) / (2 * d)
	rs := math.Sqrt(c1.r*c1.r - rc*rc)
	e := point{(c2.x - c1.x) / d, (c2.y - c1.y) / d}
	p1 := point{c1.x + e.x*rc - e.y*rs, c1.y + e.x*rs + e.y*rc}
	p2 := point{c1.x + e.x*rc + e.y*rs, c1.y - e.x*rs + e.y*rc}
	res = append(res, p1)
	if dist(p1, p2) >= eps {
		res = append(res, p2)
	}
	return res
}


Measured memory_bytes: 6396