using System;
using CompLib.Util;

public class Program
{
    private int N, K;
    private double[] X, Y, C;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        K = sc.NextInt();
        X = new double[N];
        Y = new double[N];
        C = new double[N];
        for (int i = 0; i < N; i++)
        {
            X[i] = sc.NextDouble();
            Y[i] = sc.NextDouble();
            C[i] = sc.NextDouble();
        }

        // c * dist <= t
        // dist <= t/c
        // 時間tを決める t/C_iの円がN個ある K個以上重なる領域ができる最小のt

        double ok = int.MaxValue;
        double ng = 0;
        for (int q = 0; q < 100; q++)
        {
            double mid = (ok + ng) / 2;
            if (Check(mid)) ok = mid;
            else ng = mid;
        }

        Console.WriteLine($"{ok:f10}");
    }

    bool Check(double t)
    {
        // t/C_iの円がN個ある
        // K個以上重なる

        // ある円とそれを含む大きな円
        for (int i = 0; i < N; i++)
        {
            int cnt = 1;
            for (int j = 0; j < N; j++)
            {
                if (i == j) continue;
                double dx = Math.Abs(X[i] - X[j]);
                double dy = Math.Abs(Y[i] - Y[j]);
                double dist = Math.Sqrt(dx * dx + dy * dy);

                double r1 = t / C[i];
                double r2 = t / C[j];
                if (r2 >= dist + r1) cnt++;
            }

            if (cnt >= K)
            {
                return true;
            }
        }

        // ある2円の交点とそれを含む円
        for (int i = 0; i < N; i++)
        {
            for (int j = i + 1; j < N; j++)
            {
                double dx = Math.Abs(X[i] - X[j]);
                double dy = Math.Abs(Y[i] - Y[j]);
                double dist = Math.Sqrt(dx * dx + dy * dy);

                double r1 = t / C[i];
                double r2 = t / C[j];

                // 重ならない
                if (r1 + r2 < dist) continue;
                if (Math.Max(r1, r2) > dist + Math.Min(r1, r2)) continue;

                // 余弦定理
                double cos = (r1 * r1 + (dx * dx + dy * dy) - r2 * r2) / (2 * r1 * dist);
                double q = Math.Acos(cos);
                double w = Math.Atan2(Y[j] - Y[i], X[j] - X[i]);

                double p1X = X[i] + Math.Cos(w + q) * r1;
                double p1Y = Y[i] + Math.Sin(w + q) * r1;
                int cnt1 = 2;
                for (int k = 0; k < N; k++)
                {
                    if (k == i || k == j) continue;
                    double tdx = Math.Abs(X[k] - p1X);
                    double tdy = Math.Abs(Y[k] - p1Y);
                    double tr = t / C[k];
                    if (tdx * tdx + tdy * tdy <= tr * tr) cnt1++;
                }

                if (cnt1 >= K) return true;

                int cnt2 = 2;

                double p2X = X[i] + Math.Cos(w - q) * r1;
                double p2Y = Y[i] + Math.Sin(w - q) * r1;

                for (int k = 0; k < N; k++)
                {
                    if (k == i || k == j) continue;
                    double tdx = Math.Abs(X[k] - p2X);
                    double tdy = Math.Abs(Y[k] - p2Y);
                    double tr = t / C[k];
                    if (tdx * tdx + tdy * tdy <= tr * tr) cnt2++;
                }

                if (cnt2 >= K) return true;
            }
        }

        return false;
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}

Measured memory_bytes: 28188