#include <bits/stdc++.h>
        using namespace std;
        #define rep(i,a,b) for(ll i =a; i<b;++i)
        #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        #define endl "\n"
        #define pb push_back
        #define F first
        #define S second
        #define print(a)       for(auto x : a) cout << x << " "; cout << endl
        #define print1(a)      for(auto x : a) cout << x.F << " " << x.S << endl
        #define print2(a,x,y)  for(int i = x; i < y; i++) cout<< a[i]<< " "; cout << endl
        #define mk(x,y)  make_pair(x,y)
        #define dr 0.0000004
        typedef  long long  int ll;
        const int N = ( 1e6 + 5 );
        const int mod = 1e9+7;
        ll n,k;
        double ans;
        vector < pair <pair < double,double>,double > > p;
        string s;
ll pow_mod_m(ll a , ll n)
{
    if(!n)
        return 1;
    ll pt =  pow_mod_m(a,n/2);
    pt *= pt ; pt %= mod;
    if(n&1)
        pt *= a , pt %= mod;
    return pt;
}

struct LCA
{
    vector <int> height , euler , first , segtree;
    vector <bool > visited;
    int n;
    LCA(vector <vector<int>> &adj , int root  = 0)
    {
        n = adj.size();
        height.resize(n);
        first.resize(n);
        euler.reserve(2*n);
        visited.assign(n,false);
        dfs(adj,root);
        int m = euler.size();
        segtree.resize(4*m);
        build(1 , 0 , m-1);
    }
    void dfs(vector < vector <int>> &adj , int node , int h = 0)
    {
        visited[node]  = 1;
        height[node]  =h;
        first[node] = euler.size();
        euler.pb(node);
        for(auto to : adj[node])
        {
            if(!visited[to]){
                 dfs(adj ,to , h+1);
                 euler.pb(node);
            }
        }
    }
    void build(int node ,int b ,int e)
    {
        if(b == e)
            segtree[node]  = euler[b];
        else
        {
            int m = (b+e)>>1;
            build(node <<1 ,b ,m);
            build(node <<1 | 1 , m+1 , e);
            int l  =segtree[node <<1] ,r = segtree[node <<1 | 1 ] ;
            segtree[node] = ( height[l] < height[r] ) ? l  : r;
        }
    }

int query(int node , int b , int e,int L ,int R)
{
    if( b > R  || e<L)
        return -1;
    if( b >= L and e <= R )
        return segtree[node];
    int mid = ( b + e ) >> 1;
    int left  = query(node <<1 , b , mid , L ,R);
    int right = query(node <<1 |1 , mid+1,e, L,R);
    if(left == -1) return right;
    if(right == -1) return left;
    return (height[left] < height[right]) ? left : right ;
}

int lca(int u,int v)
{
    int left = first[u] , right = first[v];
    if(left > right) swap(left,right);
    return query( 1 , 0 , euler.size() -1 ,left ,right) ;
}
};

bool ok (double x, double y, double r)
{
    vector <double> res;
    rep(i,0,n)
    {
        double tx = max(abs(x - p[i].F.F) -r,0.0);
        double ty = max(abs(y - p[i].F.S) -r,0.0);
        double val = sqrt(tx*tx + ty*ty )*p[i].S;
        res.pb(val);
    }
    sort(res.begin(), res.end());
    if( res[k-1] >= ans )
    {
        return false;
    }
    return true;
}

double get_time_of_k_items(double x, double y)
{
    vector<double > res;
    rep(i,0,n)
    {
        double tx = abs(x - p[i].F.F);
        double ty = abs(y - p[i].F.S);
        double val = sqrt(tx*tx + ty*ty )*p[i].S;
        res.pb(val);
    }
    sort(res.begin() , res.end());
    return res[k-1];
}

int main()
{
     IOS;
 //    freopen("a_example (2).txt","r",stdin);
 //   freopen("c.txt","w",stdout);
    int ts =1;
  //  cin>>ts;
	while( ts-- )
    {
        cin>>n >> k;
        p.resize(n);
        rep(i,0,n)
        {
            double x,y,c;
            cin >> x >> y >> c;
            p[i] = mk(mk(x,y),c);
        }
        queue < pair < pair< double, double> , double > > q;
        q.push(mk(mk(0,0),1000));
        ans  = get_time_of_k_items(0,0);
        while( q.empty() == false )
        {
            double x,y,c;
            x = q.front().F.F;
            y = q.front().F.S;
            c = q.front().S;
            q.pop();
            if( c/2  < dr )
            {
                continue;
            }
            if(ok(x-c/2,y-c/2,c/2))
            {
                q.push(mk(mk(x-c/2,y-c/2),c/2));
                ans  = min(ans , get_time_of_k_items(x-c/2,y-c/2));
            }
            if(ok(x-c/2,y+c/2,c/2) and c >= dr)
            {
                q.push(mk(mk(x-c/2,y+c/2),c/2));
                ans  = min(ans , get_time_of_k_items(x-c/2,y+c/2));
            }
            if(ok(x+c/2,y-c/2,c/2) and c >= dr)
            {
                q.push(mk(mk(x+c/2,y-c/2),c/2));
                ans  = min(ans , get_time_of_k_items(x+c/2,y-c/2));
            }
            if( ok(x+c/2,y+c/2,c/2) and c >= dr)
            {
                q.push(mk(mk(x+c/2,y+c/2),c/2));
                ans  = min(ans , get_time_of_k_items(x+c/2,y+c/2));
            }
        }
        cout << fixed << setprecision(10) << ans <<  endl ;
    }
	return 0;
}


Measured memory_bytes: 2304