#include <bits/stdc++.h>
    #include <cstdio>
    #include <cstring>
    #include <cmath>
    #include <cstring>
    #include <chrono>
    #include <complex>
    #define ll long long int
    
    #define vi vector<int>
    #define vll vector<ll>
    #define vvi vector < vi >
    #define pii pair<int,int>
    #define pll pair<long long, long long>
    #define mod 1000000007
    #define inf 1000000000000000001;
    #define all(c) c.begin(),c.end()
    #define mp(x,y) make_pair(x,y)
    #define mem(a,val) memset(a,val,sizeof(a))
    #define eb emplace_back
    #define pb push_back
    #define f first
    #define s second
    
    using namespace std;



/*
Geometry Library which has been taken from user @alecsyde on codeforces
*/

#define double long double
const double EPS =1e-12;
#define CT double
struct Point {
  CT x, y;
  Point() {}
  Point(CT x, CT y) : x(x), y(y) {}
  Point(const Point &p) : x(p.x), y(p.y)    {}
  Point operator + (const Point &p)  const { return Point(x+p.x, y+p.y); }
  Point operator - (const Point &p)  const { return Point(x-p.x, y-p.y); }
  Point operator * (double c)     const { return Point(x*c,   y*c  ); }
  Point operator / (double c)     const { return Point(x/c,   y/c  ); }
};

CT dot(Point p, Point q)     { return p.x*q.x+p.y*q.y; }
double dist2(Point p, Point q)   { return dot(p-q,p-q); }
CT cross(Point p, Point q)   { return p.x*q.y-p.y*q.x; }
ostream &operator<<(ostream &os, const Point &p) {
  os << "(" << p.x << "," << p.y << ")";
}

bool operator < (const Point& a, const Point& b) {
    return make_pair(a.x, a.y) < make_pair(b.x, b.y);
}
bool operator == (const Point& a, const Point& b) {
    //change accordingly
    return abs(a.x-b.x)<EPS&&abs(a.y-b.y)<EPS;
    //return make_pair(a.y, a.x) == make_pair(b.y, b.x);
}


// rotate a point CCW or CW around the origin
Point RotateCCW90(Point p)   { return Point(-p.y,p.x); }
Point RotateCW90(Point p)    { return Point(p.y,-p.x); }
Point RotateCCW(Point p, double t) {
  return Point(p.x*cos(t)-p.y*sin(t), p.x*sin(t)+p.y*cos(t));
}



// compute intersection of circle centered at a with radius r
// with circle centered at b with radius R
vector<Point> CircleCircleIntersection(Point a, Point b, double r, double R) {
  vector<Point> ret;
  double d = sqrt(dist2(a, b));
  
  if (d > r+R) return ret;
  if (d+min(r, R) < max(r, R))
  {
    // cout<<r<<"..."<<R<<endl;
    ret.pb(a);
    ret.pb(b);
    ret.pb({a.x+r,a.y});
    ret.pb({a.x,a.y+r});
    ret.pb({b.x+R,b.y});
    ret.pb({b.x,b.y+R});
    ret.pb({a.x-r,a.y});
    ret.pb({a.x,a.y-r});
    ret.pb({b.x-R,b.y});
    ret.pb({b.x,b.y-R});
    return ret;
  }
  double x = (d*d-R*R+r*r)/(2*d);
  double y = sqrt(r*r-x*x);
  Point v = (b-a)/d;
  ret.push_back(a+v*x + RotateCCW90(v)*y);
  if (y > 0)
    ret.push_back(a+v*x - RotateCCW90(v)*y);
  return ret;
}




    class triple
    {
    public:
        int x,y,c;
    };


    class triple2
    {
    public:
        double x,y,r;
    };

    triple ar[101];

    triple2 ar2[101];
    int n;

    double X;

    int func(double x,double y)
    {
        
        
        int i,ans=0;
        for(i=1;i<=n;++i)
        {
            double zz = (x-ar2[i].x)*(x-ar2[i].x) + (y-ar2[i].y)*(y-ar2[i].y);
            double zz2 = (ar2[i].r+1e-9)*(ar2[i].r+1e-9);
            if(zz <= zz2)
                ++ans;
            
        }
        return ans;
    }

    bool chk(double x,int k)
    {
        int i,j;
        for(i=1;i<=n;++i)
        {
            ar2[i].x=ar[i].x;
            ar2[i].y=ar[i].y;
            ar2[i].r=(double)1.0*x/ar[i].c;
        }
        vector<Point> v;
        for(i=1;i<=n;++i)
        {
            for(j=i+1;j<=n;++j)
            {
                
                v=CircleCircleIntersection({ar2[i].x,ar2[i].y},{ar2[j].x,ar2[j].y},ar2[i].r,ar2[j].r);
                if(n==2 && v.size()>0)
                    return true;
                for(auto it : v)
                {
                    if(func(it.x,it.y) >= k)
                        return true;
                }
                
            }
        }
        return false;
    }

    int main()
    {
        std::ios::sync_with_stdio(false);
        int T;
        T=1;
        // cin.ignore(); must be there when using getline(cin, s)
        while(T--)
        {
            int i,j,k;
            cin>>n>>k;
            for(i=1;i<=n;++i)
            {
                cin>>ar[i].x>>ar[i].y>>ar[i].c;
            }
            if(n==1 || k==1)
            {
                cout<<0<<endl;
                return 0;
            }
            double l=0.0,r=1e9,mid,ans;
            X=8106.23;
            chk((double)X,k);
            X=0;
            for(i=0;i<=100;++i)
            {
                mid=(l+r)/2;
                X=mid;
                // cout<<mid<<":::"<<endl;
                // cout<<l<<" "<<r<<" "<<mid<<endl;
                if(chk(mid,k))
                {
                    r=mid;
                }
                else
                {
                    l=mid;
                }
            }
            ans=mid;
            printf("%.9Lf\n",ans);
        }
        return 0;
    }


Measured memory_bytes: 384