package main

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

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
	return scanner
}
func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	cnt := 0
	if os.Getenv("MASPY") == "ますピ" {
		fp, _ = os.Open(os.Getenv("BEET_THE_HARMONY_OF_PERFECT"))
		cnt = 2
	}
	if os.Getenv("MASPYPY") == "ますピッピ" {
		wfp, _ = os.Create(os.Getenv("NGTKANA_IS_GENIUS10"))
	}
	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)
	solve(scanner, writer)
	for i := 0; i < cnt; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
	writer.Flush()
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	n := getNextInt(scanner)
	k := getNextInt(scanner)
	xx := make([]float64, n)
	yy := make([]float64, n)
	cc := make([]float64, n)
	for i := 0; i < n; i++ {
		xx[i] = getNextFloat64(scanner)
		yy[i] = getNextFloat64(scanner)
		cc[i] = getNextFloat64(scanner)
	}
	l := 0.0
	r := 1e18
	circles := centers(xx, yy)
	for t := 0; t < 100; t++ {
		m := (l + r) / 2.0
		cr := make([]complex128, 0)
		for i := 0; i < n; i++ {
			for j := 0; j < i; j++ {
				for _, p := range crossed(circles[i], circles[j], m/cc[i], m/cc[j]) {
					cr = append(cr, p)
				}
			}
		}
		if enable(circles, circles, cc, m) >= k {
			r = m
			continue
		}
		if enable(cr, circles, cc, m) >= k {
			r = m
			continue
		}
		l = m
	}

	fmt.Fprintln(writer, l)
}

func enable(pp, circles []complex128, cc []float64, m float64) int {
	max := 0
	n := len(circles)
	for _, p := range pp {
		burn := 0
		for i := 0; i < n; i++ {
			if compare(nikutime(p, circles[i], cc[i]), m) == 1 {
				continue
			}
			burn++
		}
		if max < burn {
			max = burn
		}
	}
	return max
}
func nikutime(c1, c2 complex128, c float64) float64 {
	return cmplx.Abs(c2-c1) * c
}
func crossed(c1, c2 complex128, r1, r2 float64) []complex128 {
	cc := make([]complex128, 0)
	c := c2 - c1
	_, th := cmplx.Polar(c)
	c = rotate(c, -th)
	l := cmplx.Abs(c)
	x := (math.Pow(r1, 2) - math.Pow(r2, 2) + math.Pow(l, 2)) / (l * 2)
	switch compare(math.Pow(r1, 2), math.Pow(x, 2)) {
	case 1:
		y := math.Sqrt(math.Pow(r1, 2) - math.Pow(x, 2))
		cc = append(cc, rotate(complex(x, y), th)+c1)
		cc = append(cc, rotate(complex(x, -y), th)+c1)
	case 0:
		cc = append(cc, rotate(complex(x, 0), th)+c1)
	}
	return cc
}
func centers(xx, yy []float64) []complex128 {
	n := len(xx)
	pp := make([]complex128, n)

	for i := 0; i < n; i++ {
		pp[i] = complex(xx[i], yy[i])
	}
	return pp
}

func compare(a, b float64) int {
	eps := 1e-7
	if a-b > eps {
		return 1
	}
	if b-a > eps {
		return -1
	}
	return 0
}
func rotate(v complex128, theta float64) complex128 {
	r, th := cmplx.Polar(v)
	th += theta
	return cmplx.Rect(r, th)
}
func degToRad(deg float64) float64 {
	return deg * math.Pi / 180.0
}
func radTodeg(rad float64) float64 {
	return rad * 180.0 / math.Pi
}


Measured memory_bytes: 4480