#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>

#define pb push_back
#define mp make_pair
#define taskname "A"

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
typedef long double ld;
typedef pair<int,int> ii;
typedef tree <int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

const int maxn = 3e3 + 5;
const int mod = 1e9 + 7;

struct point {
    ld x, y;

    point() {}
    point(ld x, ld y) : x(x), y(y) {}
    point operator + (const point& a) const { return point(x+a.x, y+a.y); }
    point operator - (const point& a) const { return point(x-a.x, y-a.y); }
    point operator * (const ld& k)     const { return point(x*k, y*k); }
    point operator / (const ld& k)     const { assert(k != ld(0)); return point(x/k, y/k); }

    ld operator * (const point& a)     const { return x*a.x + y*a.y; } // dot
    ld operator % (const point& a)     const { return x*a.y - y*a.x; } // cross

    friend istream& operator >> (istream& cin, point& a) {
        cin >> a.x >> a.y;
        return cin;
    }
    friend ostream& operator << (ostream& cout, point& a) {
        cout << a.x << ' ' << a.y;
        return cout;
    }

    ld norm() { return x*x + y*y; }
    ld len(){return hypot(x,y);};
    point rotate(ld alpha) {
        ld cosa = cos(alpha), sina = sin(alpha);
        return point(x * cosa - y * sina, x * sina + y * cosa);
    }

};
ld dis(point a , point b){
    return sqrt((a.x-b.x)*(a.x-b.x)+
                (a.y-b.y)*(a.y-b.y));
}
struct circle:point{
    ld r;
    bool inside(point other){
        return dis(*this,other) <= r + 1e-9;
    }
}a[maxn];
int c[maxn];
int n , k;
const ld EPS = 1e-9;

int cmp(ld x, ld y) {
    if (fabs(x - y) < EPS) return 0;
    if (x < y) return -1;
    return 1;
}
bool areIntersect(circle u, circle v) {
    if (cmp((u - v).len(), u.r + v.r) > 0) return false;
    if (cmp((u - v).len() + v.r, u.r) < 0) return false;
    if (cmp((u - v).len() + u.r, v.r) < 0) return false;
    return true;
}

vector<point> circleIntersect(circle u, circle v) {
    vector<point> res;
    if (!areIntersect(u, v)) return res;
    ld d = (u - v).len();
    ld alpha = acos((ld)(u.r * u.r + d*d - v.r * v.r) / 2.0 / u.r / d);
    if(cmp((ld)(u.r * u.r + d*d - v.r * v.r) / 2.0 / u.r / d , 1) == 0){
        alpha = 0;
    }
    point p1 = (v - u).rotate(alpha);
    point p2 = (v - u).rotate(-alpha);
    res.push_back(p1 / p1.len() * u.r + u);
    res.push_back(p2 / p2.len() * u.r + u);
    return res;
}

bool check(ld mid){
    if(cmp(mid,0)==0)return 0;
    for(int i = 1 ; i <= n ; ++i){
        a[i].r = mid / c[i];
    }
    vector<point> can;
    for(int i = 1 ; i <= n ; ++i){
        can.pb(a[i]);
//        cout << a[i].x << " " << a[i].y << " " << a[i].r << endl;
        for(int j = i + 1 ; j <= n ; ++j){
            auto tmp = circleIntersect(a[i],a[j]);
            for(auto c : tmp)can.pb(c);
        }
    }
    for(auto c : can){
//        cout << c.x << " " << c.y << endl;
        int cnt = 0;
        for(int i = 1 ; i <= n ; ++i){
            cnt += a[i].inside(c);
        }
        if(cnt >= k){
            return 1;
        }
    }
    return 0;
}

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(fopen(taskname".INP","r")){
		freopen(taskname".INP", "r",stdin);
		freopen(taskname".OUT", "w",stdout);
    }
    cin >> n >> k;
    for(int i = 1 ; i <= n ; ++i){
        cin >> a[i].x >> a[i].y >> c[i];
    }
//    cout << check(2.4) << endl;
    ld l = 0 , h = 1e9;
    for(int nt = 1 ; nt <= 100 ; ++nt){
        ld mid = (l + h) / 2;
        if(check(mid))h = mid;
        else l = mid;
    }
    cout << fixed << setprecision(6) << l;
}


Measured memory_bytes: 512