#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 510000;
const int MOD = 1000000007;
//


        signed main() {
                cout << std::setprecision(15); 
                  cerr << std::setprecision(15); 
              int n,k2;
              cin>>n>>k2;
              long double x[n],y[n],c[n];
              for(int i=0;i<n;i++){cin>>x[i]>>y[i]>>c[i];c[i]=((long double)1)/c[i];}
              if(k2==1){
                      cout<<0;
                      return 0;
              }
              long double ok=500000,ng=0,eps=0.000000001L,mid,d1,d2,s1,s2,r1,r2,t;
              int count;bool b;
              while(abs(ok-ng)>eps){
                mid=(ok+ng)/2.0l;
                b=false;
                for(int i=0;i<n;i++){
                    
                        for(int j=i+1;j<n;j++){
                                d1=x[i]-x[j];
                                d2=y[i]-y[j];
                                if(sqrtl(d1*d1+d2*d2)>(c[i]+c[j])*mid||sqrtl(d1*d1+d2*d2)<abs(c[i]-c[j])*mid)continue;
                                s1=(x[i]+x[j])/2 -mid*mid*(c[i]*c[i]-c[j]*c[j])*d1/(2*(d1*d1+d2*d2));
                                s2=(y[i]+y[j])/2 -mid*mid*(c[i]*c[i]-c[j]*c[j])*d2/(2*(d1*d1+d2*d2));
                                t=sqrtl(-1*(mid*mid*(c[i]-c[j])*(c[i]-c[j])/(2*(d1*d1+d2*d2))-0.5)*
                                (mid*mid*(c[i]+c[j])*(c[i]+c[j])/(2*(d1*d1+d2*d2))-0.5));
                                
                                r1=s1-d2*t;r2=s2+d1*t;
                                count =0;
                                 //cerr<<mid<<' '<<r1<<' '<<r2<<endl;
                                for(int k=0;k<n;k++)if(sqrtl((r1-x[k])*(r1-x[k])+(r2-y[k])*(r2-y[k]))<=c[k]*mid+eps)count++;
                                cerr<<r1<<' '<<r2<<' '<<i<<' '<<j<<' '<<mid<<endl;
                                if(count>=k2){
                                        b=true;
                                      //  cerr<<mid<<' '<<r1<<' '<<r2<<endl;
                                        break;
                                }
                                r1=s1+d2*t;r2=s2-d1*t;
                                //   cerr<<mid<<' '<<r1<<' '<<r2<<endl;
                                count =0;
                                for(int k=0;k<n;k++)if(sqrtl((r1-x[k])*(r1-x[k])+(r2-y[k])*(r2-y[k]))<=c[k]*mid+eps)count++;
                                  cerr<<r1<<' '<<r2<<' '<<i<<' '<<j<<' '<<mid<<endl;
                                if(count>=k2){
                                        b=true;
                                   //   cerr<<mid<<' '<<r1<<' '<<r2<<endl;
                                        break;
                                }

                        }
                        if(b)break;
                        r1=x[i];r2=y[i];
                                count =0;
                                for(int k=0;k<n;k++)if(sqrtl((r1-x[k])*(r1-x[k])+(r2-y[k])*(r2-y[k]))<=c[k]*mid+eps)count++;
                                if(count>=k2){
                                        b=true;
                                  //        cerr<<mid<<' '<<r1<<' '<<r2<<endl;
                                        break;
                                }
                }
                if(b)ok=mid;
                else ng=mid;
               //cerr<<ng<<endl;

              }
              cout<<ok<<endl;

        
        
        


      }


        


Measured memory_bytes: 384