#pragma GCC optimize("O3")
#pragma GCC target("avx")
#pragma GCC optimize("unroll-loops")
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define DB double
#define ST string
#define BS bitset
#define VE vector
#define VL vector<LL>
#define VP vector<pair<LL,LL>>
#define VVL vector<vector<LL>>
#define PQ priority_queue
#define PQS priority_queue<LL,vector<LL>,greater<LL>>
#define PB push_back
#define POB pop_back
#define PF push_front
#define POF pop_front
#define EB emplace_back
#define MP make_pair
#define TS to_string
#define TU to_ullong
#define FOR(i,a,n) for(i=a;i<n;i++)
#define rep(i,n) FOR(i,0,n)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define UB(a,n) *upper_bound(ALL(a),n)
#define LB(a,n) *lower_bound(ALL(a),n)
#define INF 1145141919810364364
#define PI 3.14159265358979
#define MOD 1000000007
//#define MOD 998244353
#define ERR 0.00000001
//#define ERR 0.00000000000001
#define NUM 200010
#define FAST cin.tie(0);ios::sync_with_stdio(false)

void Yn(LL a){if(a)printf("Yes\n");else printf("No\n");}
void YN(LL a){if(a)printf("YES\n");else printf("NO\n");}
LL pwmn(LL a,LL n){LL ans=1;while(ans<a)ans*=n;return ans;}
LL GCD(LL a,LL b){LL c=1,tmp=max(a,b);b=min(a,b);a=tmp;while(c!=0){c=a%b;a=b;b=c;}return a;}
LL LCM(LL a,LL b){return a*b/GCD(a,b);}
int lcmp(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return 1;if(*(LL*)a<*(LL*)b)return -1;return 0;}
int lcmpr(const void* a,const void* b){if(*(LL*)a>*(LL*)b)return -1;if(*(LL*)a<*(LL*)b)return 1;return 0;}
int ccmp(const void* a,const void* b){return *(char*)a-*(char*)b;}
int ccmpr(const void* a,const void* b){return *(char*)b-*(char*)a;}
int scmp(const void* a,const void* b){return strcmp((char*)a,(char*)b);}
int scmpr(const void* a,const void* b){return strcmp((char*)b,(char*)a);}
LL mod(LL a,LL m){if(a<0)return a%m+m;else return a%m;}
LL DIV(LL a,LL d){LL m=MOD,x=1,y=0,k;while(m){k=d/m;d-=k*m;swap(m,d);x-=k*y;swap(x,y);}return mod(a*mod(x,MOD),MOD);}
LL POW(LL a,LL n){LL ans=1;while(n>0){if(n&1)ans=ans*a%MOD;a=a*a%MOD;n>>=1;}return ans;}
LL fact[NUM],finv[NUM],inv[NUM];
void comi(){LL i;fact[0]=fact[1]=1;finv[0]=finv[1]=1;inv[1]=1;FOR(i,2,NUM){fact[i]=fact[i-1]*i%MOD;inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;finv[i]=finv[i-1]*inv[i]%MOD;}}
LL com(LL n,LL k){if(n<k||n<0||k<0)return 0;return fact[n]*(finv[k]*finv[n-k]%MOD)%MOD;}
bool cmps(pair<LL,LL> a,pair<LL,LL> b){if(a.second!=b.second)return a.second<b.second;return a.first<b.first;}

DB dist(DB x1,DB y1,DB x2,DB y2){return sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));}
void eqd(DB* vx1,DB* vy1,DB* vx2,DB* vy2,DB x1,DB y1,DB r1,DB x2,DB y2,DB r2){
  DB d=dist(x1,y1,x2,y2);
  if(d<ERR)*vx1=x1,*vy1=y1,*vx2=x2,*vy2=y2;
  else if(d-r1-r2>ERR)*vx1=*vy1=*vx2=*vy2=INF;
  else if(r1-r2+ERR>d)*vx1=*vx2=x2,*vy1=*vy2=y2;
  else if(r2-r1+ERR>d)*vx1=*vx2=x1,*vy1=*vy2=y1;
  else if(r1+r2-d>ERR){
    DB c=(r1*r1+d*d-r2*r2)/(2*r1*d),d1=r1*c,x=x1+(x2-x1)*d1/d,y=y1+(y2-y1)*d1/d,h=sqrt(r1*r1-d1*d1);
    *vx1=x-(y2-y1)*h/d,*vy1=y+(x2-x1)*h/d,*vx2=x+(y2-y1)*h/d,*vy2=y-(x2-x1)*h/d;
  }
  else *vx1=x1+(x2-x1)*r1/(r1+r2),*vy1=y1+(y2-y1)*r1/(r1+r2),*vx2=*vx1,*vy2=*vy1;
}

int main(){
  FAST;
  LL i,j,k,l,N,K,n,f;
  DB nx[2],ny[2],tmin=ERR,tmax=1000000,tmid;
  cin>>N>>K;
  DB x[N],y[N],c[N],r[N];
  rep(i,N)cin>>x[i]>>y[i]>>c[i];
  if(K==1){
    cout<<0<<endl;
    return 0;
  }
  while(tmax-tmin>ERR){
    tmid=(tmin+tmax)/2;
    rep(i,N)r[i]=tmid/c[i];
    rep(i,N)FOR(j,i+1,N){
      f=0;
      eqd(&nx[0],&ny[0],&nx[1],&ny[1],x[i],y[i],r[i],x[j],y[j],r[j]);
      //cout<<nx[0]<<" "<<ny[0]<<" "<<nx[1]<<" "<<ny[1]<<" "<<i<<" "<<j<<" "<<r[i]<<" "<<r[j]<<endl;
      if(nx[0]>1000000)continue;
      rep(k,2){
        n=0;
        rep(l,N)if(dist(nx[k],ny[k],x[l],y[l])<r[l]+ERR)n++;
        if(n>=K){
          f=1;
          goto END;
        }
      }
    }
END:
    if(f==1)tmax=tmid;
    else tmin=tmid;
  }

  printf("%.8f",tmid);
}


Measured memory_bytes: 384