//#i#include "pch.h"
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <limits.h>
#include <string>
#include <stack>
#include <deque>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <time.h>
#include <stdio.h>

typedef long long ll;
typedef std::pair<int, int> Pii;
typedef std::pair<long long, long long> Pll;
typedef std::pair<double, double> Pdd;

#define rip(i, n, s) for (int i = (s);i < (int)( n ); i++)
#define mapa make_pair
#define all(a) a.begin(), a.end()
#define MM << " " <<

template<typename T>
using MaxHeap = std::priority_queue<T>;
template<typename T>
using MinHeap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template<typename T>
inline bool chmax(T &a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
template<typename T>
inline bool chmin(T &a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

template<typename T>
std::vector<T> vec(int len, T elem) { return std::vector<T>(len, elem); }
template<typename T>
void vdeb(std::vector<T> &da) {
	for (int i = 0;i < da.size();i++) {
		if (i == da.size() - 1) std::cout << da[i];
		else std::cout << da[i] << ' ';
	}
	std::cout << std::endl;
}
template<typename T>
void vdeb(std::vector<std::vector<T>> &da) {
	for (int i = 0;i < da.size();i++) vdeb(da[i]);
	std::cout << std::endl;
}

using namespace std;

struct Circle{
	complex<double> cent;
	double radius;
	Circle(complex<double> _cen, double rad){
		cent = _cen;
		radius = rad;
	}
};

struct Meat{
	complex<double> pos;
	double c;
	Meat(){}
	Meat(complex<double> _pos, double _c){
		pos = _pos;
		c = _c;
	}
};

double square(double x, double y, double z){
	double s = (x+y+z)/2;
	return sqrt(s*(s-x)*(s-y)*(s-z));
}

const complex<double> EE = complex<double>(1e9, 1e9);

pair<complex<double>, complex<double>> cal(Circle x, Circle y){
	if(abs(x.cent-y.cent) >= x.radius+y.radius-1e-10){
		return mapa(EE, EE);
	}
	double S = square(abs(x.cent-y.cent), x.radius, y.radius);
	double h = S*2/abs(x.cent-y.cent);
	complex<double>  base = (y.cent-x.cent)/abs(x.cent-y.cent),p = x.cent+sqrt(x.radius*x.radius-h*h)*base;
	complex<double> z;
	z.imag(1);
	z.real(0);
	return make_pair(p+base*h*z, p-base*h*z);
}

int main(){
	int n,k;cin >> n >> k;
	vector<Meat> da(n);
	rip(i,n,0){
		int x,y,c;
		cin >> x >> y >> c;
		da[i].pos.real(x);da[i].pos.imag(y);da[i].c = c;
	}
	/*auto now = cal(Circle(da[0].pos, da[0].c),Circle(da[1].pos, da[1].c));
	cout << now.first MM now.second << endl;*/
	double big = 2000000, small = 0;
	rip(hoge,50,0){
		double now = (big+small)/2;
		vector<complex<double>> li(0);
		rip(i,n,0){
			li.push_back(da[i].pos);
		}
		rip(i,n,1){
			rip(j,i,0){
				auto gg = cal(Circle(da[i].pos, now/da[i].c),Circle(da[j].pos, now/da[j].c));
				li.push_back(gg.first);
				li.push_back(gg.second);
			}
		}
		int m = li.size();
		bool ju = false;
		rip(i,m,0){
			if(li[i] == EE){
				continue;
			}
			int co = 0;
			rip(j,n,0){
				//cout << now MM li[i].first MM abs(li[i].first - da[j].pos)<< endl;
				if(abs(li[i] - da[j].pos)*da[j].c - now*1e-10 < now){
					co++;
				}
			}
			if(co >= k){
				ju = true;
				break;
			}
		}
		if(ju){
			big = now;
		}
		else{
			small = now;
		}
	}
	printf("%.07f\n", small);
}

Measured memory_bytes: 512