//#include "bits/stdc++.h"

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<unordered_map>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

struct P
{
	double x, y;
	P(double x,double y) :x(x), y(y) {}
	P() :P(0, 0) {}
	P operator+(const P& v)const
	{
		return P(x + v.x, y + v.y);
	}
	P operator-(const P& v)const
	{
		return P(x - v.x, y - v.y);
	}
	P operator*(const double v)const
	{
		return P(x*v, y*v);
	}
	P operator/(const double v)const
	{
		return P(x/v,y/v);
	}
	bool operator==(const P& v)const
	{
		return abs(x - v.x) <= 0.0000000000001&&abs(y - v.y) <= 0.00000000000001;
	}
	bool operator!=(const P& v)const
	{
		return abs(x - v.x) > 0.0000000000001 || abs(y - v.y) > 0.00000000000001;
	}

	double dot(const P& v)const
	{
		return x*v.x + y*v.y;
	}
	double cross(const P& v)const
	{
		return x*v.y - y*v.x;
	}
	double length()const
	{
		return sqrt(x*x + y*y);
	}
	double length2()const
	{
		return (x*x + y*y);
	}

	P unit()const
	{
		return P(x / length(), y / length());
	}
	
	bool operator<(const P& v)const
	{
		return x<v.x || (x == v.x) && y < v.y;
	}
	bool operator>(const P& v)const
	{
		return x>v.x || (x == v.x) && y > v.y;
	}
	P rotate(double theta) {
        return P(x * cos(theta) - y * sin(theta), x * sin(theta) + y * cos(theta));
    }
};

vector<P> circleIntersections(P c1,P c2,double r1,double r2)
{
	vector<P> res;

	bool b1=(c1-c2).length()>r1+r2;
	bool b2=(c1-c2).length()+r1 < r2;
	bool b3=(c1-c2).length()+r2 < r1;

	if(b1||b2||b3)return res;

	double d=(c1-c2).length();
	double rc=(r1*r1+d*d-r2*r2)/(2*d);
	double rs=sqrt(r1*r1-rc*rc);

	P e1=(c2-c1)/d;

	if(rs<EPS)
	{
		res.push_back(c1+e1*rc);
	}
	else
	{
		P e2=e1.rotate(M_PI/2);
		P e3=e1.rotate(-M_PI/2);
		P A=c1+e1*rc+e2*rs;
		P B=c1+e1*rc+e3*rs;
		res.push_back(A);
		res.push_back(B);
	}

	return res;
}

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);

	int N,K;
	cin>>N>>K;
	vector<double> C(N);
	vector<P> PV(N);

	rep(i,0,N)cin>>PV[i].x>>PV[i].y>>C[i];

	double l=0,r=1e8;
	rep(t,0,200)
	{
		double mid=(l+r)/2.0;
		int res=0;
		vector<P> TP;

		rep(i,0,N)
		{
			TP.push_back(PV[i]);
		}
		rep(i,0,N)rep(j,i+1,N)
		{
			if((PV[i]-PV[j]).length()>mid/C[i]+mid/C[j]||(PV[i]-PV[j]).length()+mid/C[i] < mid/C[j]||(PV[i]-PV[j]).length()+mid/C[j] < mid/C[i])continue;
			auto CP = circleIntersections(PV[i], PV[j], mid/C[i], mid/C[j]);
			for(auto p:CP)
			{
				TP.push_back(p);
			}
		}

		for(auto p:TP)
		{
			int tres=0;
			rep(i,0,N)
			{
				if((PV[i]-p).length() < mid/C[i]+EPS)
				{
					tres++;
				}
			}
			chmax(res,tres);
		}

		if(res>=K)
		{
			r=mid;
		}
		else
		{
			l=mid;
		}
	}

	cout<<fixed<<setprecision(12)<<r<<endl;
	
	return 0;
}

Measured memory_bytes: 512