#include <bits/stdc++.h>
using namespace std;

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define dump(x)  cerr << #x << " = " << (x) << endl
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

long double add(long double a, long double b) {
    return (abs(a + b) < EPS * (abs(a) + abs(b))) ? 0 : a + b;
}

struct Point {
    long double x, y;
    Point (long double x, long double y) : x(x), y(y) {}
    Point () = default;

    Point operator + (const Point & point) const {
        return Point(add(x,point.x), add(y,point.y));
    }
    Point operator - (const Point & point) const {
        return Point(add(x,-point.x), add(y,-point.y));
    }
    Point operator * (const long double d) const {
        return Point(x * d, y * d);
    }
    Point operator / (const long double d) const {
        return Point(x / d, y / d);
    }
    Point operator * (const Point & point) const {
        return Point(add(x * point.x, -y * point.y), add(x * point.y, y * point.x));
    }
};

struct Circle {
    Point center;
    long double radius;
    Circle (Point center, long double radius) : center(center), radius(radius) {}
    Circle () = default;
};

long double getSquareDistance(Point const & a, Point const & b) {
    return pow(abs(a.x - b.x), 2) + pow(abs(a.y - b.y), 2);
}

long double getDistance(Point const & a, Point const & b) {
    return sqrt(getSquareDistance(a, b));
}

vector<Point> getIntersections(Circle const & a, Circle const & b) {
    vector<Point> intersections;
    // No intersections.
    if (getDistance(a.center, b.center) - (a.radius + b.radius) > EPS // too far
        || abs(a.radius - b.radius) - getDistance(a.center, b.center) > EPS) { // included
        return intersections;
    }
    long double d = getDistance(a.center, b.center);
    Point diff = (b.center - a.center) / d;
    long double rc = (d * d + pow(a.radius, 2) - pow(b.radius, 2)) / (2 * d);
    if (abs(getDistance(a.center, b.center) - (a.radius + b.radius)) < EPS) {
        intersections = {a.center + diff * Point(rc, 0)};
    } else {
        long double rs = sqrt(pow(a.radius, 2) - pow(rc, 2));
        assert(!isnan(rs));
        intersections = {a.center + diff * Point(rc, rs), a.center + diff * Point(rc, -rs)};
    }
    for (const auto & intersection : intersections) {
        assert(abs(getDistance(a.center, intersection) - a.radius) < EPS);
        assert(abs(getDistance(b.center, intersection) - b.radius) < EPS);
    }
    return intersections;
}

void solve(long long N, long long K, std::vector<long long> x, std::vector<long long> y, std::vector<long long> c){
    long double left = 0, right = 1e10;
    vector<Point> points(N);
    rep(i,0,N) {
        points[i].x = x[i];
        points[i].y = y[i];
    }
    rep(_,0,100) {
        long double middle = (left + right) / 2;
        bool ok = false;
        rep(i,0,N) {
            rep (j,0,N) {
                Circle a(points[i], middle / c[i]), b(points[j], middle / c[j]);
                vector<Point> intersections = {a.center};
                if (i != j and getDistance(a.center, b.center) < a.radius + b.radius) {
                    intersections = getIntersections(a, b);
                }
                for (const auto & center : intersections) {
                    int cnt = 0;
                    rep(k,0,N) {
                        if (getDistance(center, points[k]) < middle / c[k] + EPS) cnt++;
                    }
                    if (cnt >= K) {
                        ok = true;
                        break;
                    }
                }
                if (ok) break;
            }
            if (ok) break;
        }
        if (ok) right = middle;
        else left = middle;
    }
    cout << fixed << setprecision(20) << left << endl;
}

signed main(){
    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> x(N);
    std::vector<long long> y(N);
    std::vector<long long> c(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&x[i]);
        scanf("%lld",&y[i]);
        scanf("%lld",&c[i]);
    }
    solve(N, K, std::move(x), std::move(y), std::move(c));
    return 0;
}


Measured memory_bytes: 256