using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Geometry2D;
using System.Diagnostics;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	const double eps = Sign.Eps;
	public void Solve(){
		
		if(N == 1 || K == 1){
			Console.WriteLine(0);
			return;
		}
		
		double l = 0, r = 2e5; // > 1414.2 * 100
		for(int t = 0; t < 100; t++){
			
			double c = (l + r) / 2.0;
			bool chk = false;
			
			var circles = new Circle[N];
			for(int i=0;i<N;i++) circles[i] = new Circle(new Point(X[i], Y[i]), c / C[i]);
			
			for(int i=0;i<N;i++){
				for(int j=0;j<N;j++){
					var crs = CrossPoint.Solve(circles[i], circles[j]);
					if(crs.Count == 0) crs.Add(circles[i].Center);
					foreach(var p in crs){
						int inc = 0;
						foreach(var ci in circles){
							if(Sign.LessEq((p - ci.Center).R, ci.Radius)) inc++;
						}
						if(inc >= K){
							chk = true;
						}
					}
				}
			}
			if(!chk){
				l = c;
			} else {
				r = c;
			}
		}
		
		Console.WriteLine((l + r) * 0.5);
		
	}
	int N,K;
	int[] X,Y,C;
	public Sol(){
		var d = ria();
		N = d[0]; K = d[1];
		X = new int[N];
		Y = new int[N];
		C = new int[N];
		for(int i=0;i<N;i++){
			d = ria();
			X[i] = d[0];
			Y[i] = d[1];
			C[i] = d[2];
		}
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


namespace Geometry2D {
	static class Sign {
		public const double Eps = 1e-9; 
		public static bool IsZero(double v){ return Math.Abs(v) <= Eps; }
		public static bool Eq(double lhs, double rhs){ return IsZero(lhs - rhs); }
		public static bool Less(double lhs, double rhs){ return lhs + Eps < rhs; }
		public static bool LessEq(double lhs, double rhs){ return Eq(lhs, rhs) || Less(lhs, rhs); }
		public static bool Greater(double lhs, double rhs){ return lhs > rhs + Eps; }
		public static bool GreaterEq(double lhs, double rhs){ return Eq(lhs, rhs) || Greater(lhs, rhs); }
	}
	
	struct Point {
		public double X, Y;
		public Point(double x = 0.0, double y = 0.0) {
			X = x; Y = y;
		}
		public double R2{
			get {return X * X + Y * Y;}
		}
		public double R{
			get {return Math.Sqrt(this.R2);}
		}
		public double Arg{
			get {return Math.Atan2(Y, X);}
		}
		
		public override String ToString(){
			return String.Format("[{0}, {1}]", X, Y);
		}

		public static Point operator +(Point p, Point q) {
			return new Point(p.X + q.X, p.Y + q.Y);
		}
		public static Point operator -(Point p, Point q) {
			return new Point(p.X - q.X, p.Y - q.Y);
		}
		public static Point operator -(Point p) {
			return new Point(-p.X, -p.Y);
		}
		public static Point operator *(double r, Point p) {
			return new Point(r * p.X, r * p.Y);
		}
		public static Point operator *(Point p ,double r) {
			return new Point(p.X * r, p.Y * r);
		}
		public static Point operator /(Point p, double r) {
			return new Point(p.X / r, p.Y / r);
		}
		
		public static Point Projection(Point p, Point b){
			return (Metrics.Dot(p, b) / b.R2) * b;
		}
	}

	struct Segment {
		public Point P, Q;
		public Segment(Point p, Point q){
			P = p; Q = q;
		}
		public double Length{
			get { return (P - Q).R;}
		}
		public double Length2{
			get { return (P - Q).R2;}
		}
	}
	
	struct Line {
		// A x + B y + C == 0
		public Point P, Q;
		public double A, B, C;
		public Line(double a = 1.0, double b = 1.0, double c = 1.0){
			A = a; B = b; C = c;
			P = new Point(); Q = new Point();
			if(!Sign.IsZero(b)){
				P.X = 0.0; P.Y = -c / b;
			} else {
				P.X = -c / a; P.Y = 0.0;
			}
			Q.X = P.X - B;
			Q.Y = P.Y + A;
		}
		
		public Line(Point p, Point q){
			P = p; Q = q;
			var dir = Q - P;
			var bs = P;
			A = dir.Y;
			B = -dir.X;
			C = - (A * bs.X + B * bs.Y);
		}
		
		public Point Normal {
			get {
				return new Point(A, B);
			}
		}
		public Point Direction {
			get {
				return new Point(-B, A);
			}
		}
		public String EquationExpression {
			get{
				return String.Format("{0} * X + {1} * Y + {2} == 0", A, B, C);
			}
		}
		
		public static Line FromDirectionVector(Point direction, Point basepoint){
			return new Line(basepoint, direction + basepoint);
		}
		
		public static Line FromTwoPoint(Point p, Point q){
			return FromDirectionVector(p - q, p);
		}
		
	}
	
	struct Circle {
		// center, radius;
		public Point Center;
		public double Radius;
		public Circle(Point center, double radius){
			Center = center; Radius = radius;
		}
		
		public override String ToString(){
			return String.Format("{0}, {1}", Center, Radius);
		}
	}
	
	static class Metrics {
		public static double Dot(Point p, Point q) {
			return p.X * q.X + p.Y * q.Y;
		}
		public static double Dot(double px, double py, double qx, double qy) {
			return px * qx + py * qy;
		}
		
		public static double Det(Point p, Point q) {
			return p.X * q.Y - p.Y * q.X;
		}
		public static double Det(double px, double py, double qx, double qy) {
			return px * qy - py * qx;
		}
		
		public static double Distance(Point p1, Point p2){
			return (p1 - p2).R;
		}
		public static double Distance(Point p, Line l){
			var area = Metrics.Det(p - l.P, l.Q - l.P);
			if(Sign.IsZero(area)) return 0.0;
			return Math.Abs(area / (l.P - l.Q).R);
		}
		public static double Distance(Point p, Segment s){
			var l = new Line(s.P, s.Q);
			var h = Relation.PerpendicularFoot(p, l);
			if(Relation.Intersects(h, s)) return (h - p).R;
			return Math.Min((p - s.P).R, (p - s.Q).R);
		}
		public static double Distance(Line l, Point p){
			return Distance(p, l);
		}
		public static double Distance(Line l1, Line l2){
			return Distance(l1.P, l2);
		}
		public static double Distance(Line l, Segment s){
			if(Relation.Intersects(l, s)) return 0.0;
			return Math.Min(Distance(s.P, l), Distance(s.Q, l));
		}
		
		public static double Distance(Segment s, Point p){
			return Distance(p, s);
		}
		public static double Distance(Segment s, Line l){
			return Distance(l, s);
		}
		public static double Distance(Segment s1, Segment s2){
			if(Relation.Intersects(s1, s2)) return 0.0;
			var d1 = Math.Min(Distance(s1.P, s2), Distance(s1.Q, s2));
			var d2 = Math.Min(Distance(s2.P, s1), Distance(s2.Q, s1));
			return Math.Min(d1, d2);
		}
		
	}
	
	static class Relation{
		public static bool ParallelOrEq(Line l1, Line l2){
			return Sign.IsZero(Metrics.Det(l1.Direction, l2.Direction));
		}
		public static bool Parallel(Line l1, Line l2){
			return Sign.IsZero(Metrics.Det(l1.Direction, l2.Direction)) && !Eq(l1, l2);
		}
		public static bool Eq(Line l1, Line l2){
			return Sign.IsZero(Metrics.Det(l1.P - l1.Q, l1.P - l2.Q)) && Sign.IsZero(Metrics.Det(l1.P - l1.Q, l1.P - l2.P));
		}
		public static bool Eq(Point p, Point q){
			return Sign.IsZero(p.X - q.X) && Sign.IsZero(p.Y - q.Y);
		}
		public static bool Eq(Segment s1, Segment s2){
			return (Eq(s1.P, s2.P) && Eq(s1.Q, s2.Q)) || (Eq(s1.P, s2.Q) && Eq(s1.Q, s2.P));
		}
		public static bool Eq(Circle c1, Circle c2){
			return Eq(c1.Center, c2.Center) && Sign.IsZero(c1.Radius - c2.Radius);
		}
		
		public static bool Intersects(Point p, Line l){
			return Sign.IsZero(Metrics.Det(p - l.P, l.Q - l.P));
		}
		public static bool Intersects(Point p, Segment s){
			if(!Sign.IsZero(Metrics.Det(p - s.P, s.Q - s.P))) return false;
			return Sign.LessEq(Metrics.Dot(p - s.P, p - s.Q), 0.0);
		}
		public static bool Intersects(Point p, Circle c){
			return Sign.Eq((c.Center - p).R, c.Radius);
		}
		
		
		public static bool Intersects(Line l, Point p){
			return Intersects(p, l);
		}
		public static bool Intersects(Line l1, Line l2){
			return !(Relation.Parallel(l1, l2) || Relation.Eq(l1, l2));
		}
		public static bool Intersects(Line l, Segment s){
			if(Intersects(s.P, l) || Intersects(s.Q, l)) return true;
			var dir = l.Q - l.P;
			var v0 = s.P - l.P;
			var v1 = s.Q - l.P;
			if(Sign.Greater(Metrics.Det(v0, dir), 0) && Sign.Less(Metrics.Det(v1, dir), 0)) return true;
			if(Sign.Greater(Metrics.Det(v1, dir), 0) && Sign.Less(Metrics.Det(v0, dir), 0)) return true;
			return false;
		}
		public static bool Intersects(Line l, Circle c){
			return Sign.LessEq(Metrics.Distance(l, c.Center), c.Radius);
		}
		public static bool Tangent(Line l, Circle c){
			return Sign.Eq(Metrics.Distance(l, c.Center), c.Radius);
		}
		
		
		public static bool Intersects(Segment s, Point p){
			return Intersects(p, s);
		}
		public static bool Intersects(Segment s, Line l){
			return Intersects(l, s);
		}
		public static bool Intersects(Segment s1, Segment s2){
			if(Intersects(s1.P, s2) || Intersects(s1.Q, s2)) return true;
			if(Intersects(s2.P, s1) || Intersects(s2.Q, s1)) return true;
			var d1 = s1.Q - s1.P;
			var v10 = s2.P - s1.P;
			var v11 = s2.Q - s1.P;
			var chk1 = (Sign.Greater(Metrics.Det(v10, d1), 0) && Sign.Less(Metrics.Det(v11, d1), 0))
					 || (Sign.Greater(Metrics.Det(v11, d1), 0) && Sign.Less(Metrics.Det(v10, d1), 0));
			var d2 = s2.Q - s2.P;
			var v20 = s1.P - s2.P;
			var v21 = s1.Q - s2.P;
			var chk2 = (Sign.Greater(Metrics.Det(v20, d2), 0) && Sign.Less(Metrics.Det(v21, d2), 0))
					 || (Sign.Greater(Metrics.Det(v21, d2), 0) && Sign.Less(Metrics.Det(v20, d2), 0));
			return chk1 & chk2;
		}
		public static bool Intersects(Segment s, Circle c){
			return Sign.LessEq(Metrics.Distance(s, c.Center), c.Radius);
		}
		
		public static bool Intersects(Circle c, Point p){
			return Intersects(p, c);
		}
		public static bool Intersects(Circle c, Line l){
			return Intersects(l, c);
		}
		public static bool Tangent(Circle c, Line l){
			return Tangent(l, c);
		}
		
		public static bool Intersects(Circle c, Segment s){
			return Intersects(c, s);
		}
		public static IntersectionModeC2C IntersectionMode(Circle c1, Circle c2){
			// -1 : infinite
			// 0 : not intersect
			// 1 : outer tangent
			// 2 : cross at two point
			// 3 : inner tangent
			if(Eq(c1.Center, c2.Center) && Sign.Eq(c1.Radius, c2.Radius)) return IntersectionModeC2C.Infinite;
			var d = (c1.Center - c2.Center).R;
			if(Sign.Less(c1.Radius + c2.Radius, d)) return IntersectionModeC2C.NoIntersection;
			if(Sign.Eq(c1.Radius + c2.Radius, d)) return IntersectionModeC2C.TangentExternally;
			var ma = Math.Max(c1.Radius, c2.Radius);
			var mi = Math.Min(c1.Radius, c2.Radius);
			if(Sign.Less(d, c1.Radius + c2.Radius) && Sign.Less(ma, mi + d)) return IntersectionModeC2C.IntersectAtTwo;
			if(Sign.Eq(ma, mi + d)) return IntersectionModeC2C.TangentInternally;
			if(Sign.Greater(ma, mi + d)) return IntersectionModeC2C.Infinite;
			return IntersectionModeC2C.Infinite;
		}
		public enum IntersectionModeC2C : int{
			Infinite = -1,
			NoIntersection = 0,
			TangentExternally = 1,
			IntersectAtTwo = 2,
			TangentInternally = 3
		}
		
		public static bool Intersects(Circle c1, Circle c2){
			return IntersectionMode(c1, c2) != IntersectionModeC2C.NoIntersection;
		}
		
		
		
		public static Point PerpendicularFoot(Point p, Line l){
			return Point.Projection(p - l.P, l.Q - l.P) + l.P;
		}
		
	}
	
	static class CrossPoint{
		
		public static List<Point> Solve(Line l1, Line l2){
			if(!Relation.Intersects(l1, l2)) return new List<Point>();
			double a = l1.A, b = l1.B, e = l1.C * -1;
			double c = l2.A, d = l2.B, f = l2.C * -1;
			double det = a * d - b * c;
			double x = d * e+ -b * f;
			double y = -c * e + a * f;
			var ret = new List<Point>();
			ret.Add(new Point(x / det, y / det));
			return ret; 
		}
		public static List<Point> Solve(Segment s, Line l){
			if(!Relation.Intersects(s, l)) return new List<Point>();
			var l2 = new Line(s.P, s.Q);
			return Solve(l, l2); 
		}
		public static List<Point> Solve(Line l, Segment s){
			return Solve(s, l);
		}
		public static List<Point> Solve(Segment s1, Segment s2){
			if(!Relation.Intersects(s1, s2)) return new List<Point>();
			var l1 = new Line(s1.P, s1.Q);
			var l2 = new Line(s2.P, s2.Q);
			return Solve(l1, l2); 
		}
		
		public static List<Point> Solve(Circle c, Line l){
			if(!Relation.Intersects(l, c)) return new List<Point>();
			var ret = new List<Point>();
			var h = Relation.PerpendicularFoot(c.Center, l);
			// proj_foot ＋/- direction_unit * sqrt（R^2-proj.R^2)
			if(Relation.Tangent(l, c)){
				ret.Add(h);
			} else {
				var dir = l.Direction;
				dir /= dir.R;
				dir *= Math.Sqrt(Math.Max(0, c.Radius * c.Radius - (h - c.Center).R2)) / dir.R;
				ret.Add(h + dir);
				ret.Add(h - dir);
			}
			#if DEBUG
				//foreach(var p in ret) Debug.Assert(Relation.Intersects(p, c));
				//foreach(var p in ret) Debug.Assert(Relation.Intersects(p, l));
				foreach(var p in ret) if(!Relation.Intersects(p, c)) Console.Error.WriteLine("@point 2 circle: {0} {1}: diff:{2}, eps:{3}", (p - c.Center).R, c.Radius, Math.Abs((p - c.Center).R - c.Radius), Sign.Eps);
				foreach(var p in ret) if(!Relation.Intersects(p, l)) Console.Error.WriteLine("@point 2 line: {0} {1}: diff:{2}, eps:{3}", p, l.EquationExpression, Metrics.Det(p - l.P, l.Q - l.P), Sign.Eps);
			#endif
			return ret; 
		}
		
		public static Line AlgebraicSub(Circle c1, Circle c2){
			// returns line through 2 crosspoints from c1 and c2 if exists else some line;
			double a = -2 * c1.Center.X + 2 * c2.Center.X;
			double b = -2 * c1.Center.Y + 2 * c2.Center.Y;
			double c = (c1.Center.R2 - c1.Radius * c1.Radius) - (c2.Center.R2 - c2.Radius * c2.Radius);
			return new Line(a, b, c);
		}
		public static List<Point> Solve(Circle c1, Circle c2){
			var ret = new List<Point>();
			switch(Relation.IntersectionMode(c1, c2)){
				case Relation.IntersectionModeC2C.Infinite: break;
				case Relation.IntersectionModeC2C.NoIntersection: break;
				case Relation.IntersectionModeC2C.TangentExternally:{
					ret = Solve(c1, AlgebraicSub(c1, c2));
				} break;
				case Relation.IntersectionModeC2C.IntersectAtTwo:{
					ret = Solve(c1, AlgebraicSub(c1, c2));
				} break;
				case Relation.IntersectionModeC2C.TangentInternally:{
					ret = Solve(c1, AlgebraicSub(c1, c2));
				} break;
				default: break;
			}
			
			#if DEBUG
				//foreach(var p in ret) Debug.Assert(Relation.Intersects(p, c1));
				//foreach(var p in ret) Debug.Assert(Relation.Intersects(p, c2));
				foreach(var p in ret) if(!Relation.Intersects(p, c1)) Console.Error.WriteLine("@point 2 circle: {0} {1}: diff:{2}, eps:{3}", (p - c1.Center).R, c1.Radius, Math.Abs((p - c1.Center).R - c1.Radius), Sign.Eps);
				foreach(var p in ret) if(!Relation.Intersects(p, c2)) Console.Error.WriteLine("@point 2 circle: {0} {1}: diff:{2}, eps:{3}", (p - c2.Center).R, c2.Radius, Math.Abs((p - c2.Center).R - c2.Radius), Sign.Eps);
			#endif
			return ret; 
		}
		
		
		
	}
	
}



Measured memory_bytes: 17460