#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <time.h>
#include <stack>
#include <array>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
//typedef pair<int, int> P;
const double EPS=1e-10;
double add(double a, double b){
    if(abs(a+b)<EPS*(abs(a)+abs(b))) return 0;
    return a+b;
}
   
struct P{
    double x, y;
    P() {}
    P(double x, double y): x(x), y(y){
    }
    P operator+ (P p){
        return P(add(x, p.x), add(y, p.y));
    }
    P operator- (P p){
        return P(add(x, -p.x), add(y, -p.y));
    }
    P operator* (double d){
        return P(x*d, y*d);
    }
    double dot(P p){
        return add(x*p.x, y*p.y);
    }
    double det(P p){
        return add(x*p.y, -y*p.x);
    }
    bool operator< (const P& p) const{
        if(abs(x-p.x)>EPS){
            return x<p.x;
        }else{
            return y<p.y-EPS;
        }
    }
};
typedef pair<P, P> Ppair;
bool on_seg(P p1, P p2, P q){
    return (p1-q).det(p2-q)==0 && (p1-q).dot(p2-q)<=0;
}
   
P intersection(P p1, P p2, P q1, P q2){
    return p1+(p2-p1)*((q2-q1).det(q1-p1) / (q2-q1).det(p2-p1));
}
 
double dist(P p1, P p2){
  return sqrt((p1-p2).dot(p1-p2));
}
 
double dist_ptseg(P p1, P p2, P q){
    double d1=sqrt((p1-q).dot(p1-q)), d2=sqrt((p2-q).dot(p2-q));
    if(abs(p1.x-p2.x)<EPS && abs(p1.y-p2.y)<EPS){
        return d1;
    }
    P r=P((p2-p1).y, (p1-p2).x);
    P s=intersection(p1, p2, q, q+r);
    if(on_seg(p1, p2, s)){
        return sqrt((q-s).dot(q-s));
    }else{
        return min(d1, d2);
    }
}
 
double dist_segs(P p1, P p2, P q1, P q2){
    if((q2-q1).det(p2-p1)!=0){
        P r=intersection(p1, p2, q1, q2);
        if(on_seg(p1, p2, r) && on_seg(q1, q2, r)) return 0;
    }
    double d1=dist_ptseg(p1, p2, q1), d2=dist_ptseg(p1, p2, q2), d3=dist_ptseg(q1, q2, p1), d4=dist_ptseg(q1, q2, p2);
    double d=min(d1, min(d2, min(d3, d4)));
    return d;
}
 
Ppair circ_intersection(P p1, double r1, P p2, double r2){ //2点で交わるか接する(同じ点を返す)
    P q=(p2-p1)*((r1*r1-r2*r2-p1.dot(p1)+p2.dot(p2))/(2.0*((p2-p1).dot(p2-p1))));
    P r=P((p2-p1).y, (p1-p2).x);
    double sq=(r.dot(q-p1))*(r.dot(q-p1))-(r.dot(r))*((q-p1).dot(q-p1)-r1*r1);
	if(abs(sq)<EPS){
		sq=0;
	}else{
		sq=sqrt(sq);
	}
    double t1=(-(r.dot(q-p1))+sq)/(r.dot(r));
    double t2=(-(r.dot(q-p1))-sq)/(r.dot(r));
    P s1=q+r*t1, s2=q+r*t2;
    return Ppair(s1, s2);
}
int main()
{
	int n, k;
	cin>>n>>k;
	P p[100];
	double c[100];
	for(int i=0; i<n; i++){
		cin>>p[i].x>>p[i].y>>c[i];
	}
	if(k==1){
		cout<<0<<endl;
		return 0;
	}
	auto count=[&](double d, P q){
		int cnt=0;
		for(int i=0; i<n; i++){
			if(dist(p[i], q)<=d/c[i]+EPS) cnt++;
		}
		return cnt;
	};
	auto check=[&](double m){
		for(int i=0; i<n; i++){
			if(count(m, p[i])>=k) return true;
		}
		for(int i=0; i<n; i++){
			for(int j=0; j<i; j++){
				double d=dist(p[i], p[j]);
				if(d<abs(m/c[i]-m/c[j])) continue;
				if(d>m/c[i]+m/c[j]) continue;
				auto pp=circ_intersection(p[i], m/c[i], p[j], m/c[j]);
				if(count(m, pp.first)>=k) return true;
				if(count(m, pp.second)>=k) return true;
			}
		}
		return false;
	};
	double l=0, r=300000;
	for(int loop=0; loop<100; loop++){
		double m=(l+r)/2;
		if(check(m)) r=m;
		else l=m;
	}
	printf("%.7lf\n", r);
    return 0;
}


Measured memory_bytes: 256