#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<vector<vector<bool>>> vvvb;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<vpll> vvpll;
typedef vector<double> vd;
typedef vector<vd> vdd;

typedef pair<double, double> pd;
typedef vector<pd> vpd;


#define FOR(i,x,y) for(ll i=(ll)x; i<(ll)y; ++i)
#define REP(i,y) FOR(i, 0, y)
#define RFOR(i,x,y) for(ll i=(ll)x; i>=(ll)y; --i)
#define RREP(i,x) RFOR(i, x, 0)
#define ALL(a) a.begin(), a.end()
#define pb push_back
#define debug_print(x...) cerr << "line " << __LINE__ << " : "; debug_print_in(x);

template <typename First>
void debug_print_in(First first){
  cerr << first << endl;
  return;
}

template <typename First, typename... Rest>
void debug_print_in(First first, Rest... rest){
  cerr << first << " ";
  debug_print_in(rest...);
  return;
}

void IN(void){
  return;
}

template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
  cin >> first;
  IN(rest...);
  return;
}

template <typename First>
void OUT(First first){
  cout << first << endl;
  return;
}

template <typename First, typename... Rest>
void OUT(First first, Rest... rest){
  cout << first << " ";
  OUT(rest...);
  return;
}

template<class t, class u> t chmax(t&a,u b){if(a<b)a=b; return a;};
template<class t, class u> t chmin(t&a,u b){if(a>b)a=b; return a;};
int popcount(int t){return __builtin_popcount(t);} //GCC
int popcount(ll t){return __builtin_popcountll(t);} //GCC

template <typename T>
void vec_print(vector<T> VEC){
  REP(i, VEC.size()){
    cerr << VEC[i] << " ";
  }
  cerr << endl;
};

template <typename T>
void mat_print(vector<vector<T> > MAT){
  REP(i,MAT.size()){
    REP(j,MAT[i].size()){
      cerr << MAT[i][j] << " ";
    }
    cerr << endl;
  }
};

constexpr int INF = (1<<30);
constexpr ll INFLL = 1LL<<62;
constexpr long double EPS = 1e-12;
constexpr ll MOD = (ll)((1E+9)+7);

class Circles{
  private:
  public:
    Circles(void){
      return;
    };
    ~Circles(void){
      return;
    };

    bool intersections(double x1, double y1, double r1, double x2, double y2, double r2, vpd& ans){
      // (x-xn)^2+(y-yn)^2=rn^2
      // (-2x1x+x1^2 -2y1y+y1^2) - (-2x2x+x2^2 - 2y2y+y2^2) = r1^2-r2^2
      // 2(x2-x1)x + 2(y2-y1)y = r1^2-r2^2 + x2^2 + y2^2 - x1^2 - y1^2

      double a = 2*(x2-x1);
      double b = 2*(y2-y1);
      double c = -(r1*r1-r2*r2+x2*x2+y2*y2-x1*x1-y1*y1);

      double s = sqrt(a*a+b*b);

      double d = sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
      if(r1+r2<d) return false;
      if(d+r1<r2) return false;
      if(r2+d<r1) return false;

      double d1 = fabs(a*x1+b*y1+c)/s;

      double sa = a/s;
      double sb = b/s;

      // n = (sa, sb)
      // t = (sb, -sa)
      // (x0, y0) = (x1, y1) + kn, ax0 + by0 + c = 0
      // a(x1+ksa)+b(y1+ksb)+c=0
      // ax1+by1+c=-k(asa+bsb)=-ks

      double k = -(a*x1+b*y1+c)/s;
      double x0 = x1+k*sa;
      double y0 = y1+k*sb;

      double l = sqrt(r1*r1-d1*d1);

      ans.resize(2);
      ans[0].first = x0+l*sb; ans[0].second = y0-l*sa;
      ans[1].first = x0-l*sb; ans[1].second = y0+l*sa;

      return true;
    }
};

ll N, K;
vpd P;
vd C;
Circles que;

bool search(double T){
  vpd cand = P;
  REP(i,N){
    FOR(j,i+1,N){
      vpd tmp;
      if(que.intersections(P[i].first, P[i].second, T/C[i], P[j].first, P[j].second, T/C[j], tmp)){
        cand.pb(tmp[0]);
        cand.pb(tmp[1]);
      }
    }
  }
  vll count(cand.size(), 0);
  REP(i,N){
    REP(j,cand.size()){
      double distx = P[i].first - cand[j].first;
      double disty = P[i].second - cand[j].second;
      double dist = sqrt(distx*distx+disty*disty);
      if(dist<=T/C[i]+1.0E-9) count[j]++;
    }
  }
  ll K_max = 0;
  REP(j,cand.size()){
    chmax(K_max, count[j]);
  }
  debug_print(T, K_max);
  return K_max>=K;
};

double binary_search(double t_min, double t_max){
  debug_print(t_min, t_max);
  double t_mid = (t_min+t_max)/2;
  if((t_max-t_min)/t_mid < 1.0E-10) return t_mid;
  if((t_max-t_min)<1.0E-10) return t_mid;

  if(search(t_mid)) return binary_search(t_min, t_mid);
  return binary_search(t_mid, t_max);
}

int main(){
  cin.tie(0); // cut the cin and cout (default, std::flush is performed after std::cin)
  ios::sync_with_stdio(false); // cut the iostream and stdio (DON'T endl; BUT "\n";)

  IN(N,K);
  P.resize(N);
  C.resize(N);
  REP(i,N){
    ll x, y, c;
    IN(x,y,c);
    P[i].first = (double)x;
    P[i].second = (double)y;
    C[i] = (double)c;
  }

  double ans = binary_search(0, 10000000000);

  printf("%.12lf\n", ans);

  return 0;
}

Measured memory_bytes: 384