#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (std::size_t  i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0))return 0;
  long long x = 1;
  while (b > 0) {
    if (b & 1)x = (mod!=-1)?(x * a) % mod:x*a;
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

using ll = long long;
using P=std::pair<long long,long long>;

ll gcd(ll a,ll b){
  if(a%b==0)return b;
  return gcd(b,a%b);
}

//geometry library

using Point=std::complex<long double>;

constexpr long double EPS=1e-10;
const long double PI=std::acos(-1.0l);

bool EQ(long double a,long double b){return std::abs(a-b)<EPS;}
bool EQP(Point a,Point b){return EQ(a.real(),b.real())&&EQ(a.imag(),b.imag());}

Point unitvec(Point a){return a/std::abs(a);}

//dot a・b = |a||b|cosθ
long double dot(Point a,Point b){
  return a.real()*b.real()+a.imag()*b.imag();
}

//cross a×b = |a||b|sinθ
long double cross(Point a,Point b){
  return a.real()*b.imag()-a.imag()*b.real();
}

//直線a,b上に点cがあるか
bool on_line(Point a,Point b,Point c){
  return EQ(cross(c-a,b-a),0.0l);
}

// [a,b]上に点cがあるか
bool on_segment(Point a,Point b,Point c){
  return std::abs(c-a)+std::abs(b-c)<std::abs(b-a)+EPS;
}

std::vector<Point> crosspointCC(Point a,long double ra,Point b,long double rb){
  std::vector<Point> ret;
  Point ab=b-a;
  long double d=std::abs(ab);
  long double crL= (std::norm(ab)+ra*ra-rb*rb) / (2*d);
  if(EQ(d,0)|| ra<std::abs(crL))return ret;
  Point abN=ab*Point(0,std::sqrt(ra*ra-crL*crL)/d);
  Point cp = a+crL/d*ab;
  ret.emplace_back(cp+abN);
  if(!EQ(std::abs(abN),0))ret.emplace_back(cp-abN);
  return ret;
}

int main() {
  std::cin.tie(nullptr);
  std::ios::sync_with_stdio(false);

  constexpr long double EPS_BI=1e-7;
 
  ll n,k;
  std::cin>>n>>k;
 
  std::vector<Point> point(n);
  std::vector<long double> c(n);
 
  rep(i,0,n){
    long double x,y;
    std::cin>>x>>y>>c[i];
    point[i]=Point(x,y);
  }
 
  std::cout<<std::setprecision(10)<<std::fixed;
  std::cerr<<std::setprecision(10)<<std::fixed;
 
  long double left=0.0l,right=141410.0l;
 
  while(right-left>EPS_BI){
 
    long double mid=(left+right)/2;
 
    std::vector<Point> candi;
 
    rep(i,0,n)candi.emplace_back(point[i]);
    rep(i,0,n){
      rep(j,i+1,n){
          for(auto e:crosspointCC(point[i],mid/c[i],point[j],mid/c[j]))candi.emplace_back(e);
      }
    }
 
    ll ans=0;
    for(auto e:candi){
      ll cnt=0;
      rep(i,0,n){
        if(std::abs(e-point[i])<mid/c[i]+EPS)cnt++;
      }
      chmax(ans,cnt);
    }
    if(ans>=k)right=mid;
    else left=mid;
  }
 
  std::cout<<right<<"\n";

  return 0;
}



Measured memory_bytes: 508