#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)

double continuous_binary_search(
    double lo,
    double hi,
    function<bool(double)> is_ok,
    bool maximize,
    ll max_loop = 100
){
    REP(i, max_loop){
        const double mid = (hi + lo) / 2.0;
        if(maximize){
            if(is_ok(mid)){
                lo = mid;
            }else{
                hi = mid;
            }
        }else{
            if(is_ok(mid)){
                hi = mid;
            }else{
                lo = mid;
            }
        }
    }
    return lo;
}


template<typename T>
struct Point {
    T x, y;
    Point() : x(0), y(0) {}
    Point(T x, T y) : x(x), y(y) {}

    int quadrant() const {
        if(x == 0 && y == 0){
            return 0;
        }
        if(x >= 0){
            if(y >= 0){
                return 1;
            }else{
                return 4;
            }
        }else{
            if(y >= 0){
                return 2;
            }else{
                return 3;
            }
        }
    }

    Point& operator+=(const Point& other){
        x += other.x;
        y += other.y;
        return *this;
    }

    Point& operator-=(const Point& other){
        x -= other.x;
        y -= other.y;
        return *this;
    }

    Point operator+(const Point& other) const {
        return Point(x, y) += other;
    }
    Point operator-(const Point& other) const{
        return Point(x, y) -= other;
    }
    Point operator*(T a) const {
        return Point(x * a, y * a);
    }

    T cross(const Point& q) const {
        return x * q.y - y * q.x;
    }

    bool operator<(const Point& q) const {
        int qp = quadrant();
        int qq = q.quadrant();
        if(qp != qq){ return qp < qq; }
        return cross(q) > 0;
    }

    bool operator<=(const Point& q) const {
        int qp = quadrant();
        int qq = q.quadrant();
        if(qp != qq){ return qp < qq; }
        return cross(q) >= 0;
    }

    T dot(const Point& q) const {
        return x * q.x + y * q.y;
    }

    T norm2() const {
        return x * x + y * y;
    }

    double norm() const {
        return sqrt((double)norm2());
    }

    double dist(const Point& q) const {
        return (*this - q).norm();
    }
};

Point<double> rotate(Point<double>& p, double angle){
    const double s = sin(angle);
    const double c = cos(angle);
    return Point<double>(p.x * c - p.y * s, p.x * s + p.y * c);
}

void intersection_2circle_simple(
    double x2, double r1, double r2, vector<Point<double>>& out){
    if(abs(x2) <= 1e-8){
        return;
    }
    const auto ans_x = (r1 * r1 - r2 * r2 + x2 * x2) / 2 / x2;
    const auto ans_ysq = r1 * r1 - ans_x * ans_x;
    if(ans_ysq < 0){
        return;
    }
    const auto ans_y = sqrt(ans_ysq);
    out.emplace_back(ans_x, ans_y);
    out.emplace_back(ans_x, -ans_y);
}

// 2 つの円の交点を求める
void intersection_2circle(
    Point<double>& p1, double r1, Point<double>& p2, double r2,
    vector<Point<double>>& out){

    vector<Point<double>> tmp;
    intersection_2circle_simple(p1.dist(p2), r1, r2, tmp);
    const auto p22 = p2 - p1;
    const auto angle = atan2(p22.y, p22.x);
    REP(i, tmp.size()){
        const auto q = rotate(tmp.at(i), angle) + p1;
        assert(abs(q.dist(p1) - r1) <= 1e-5);
        assert(abs(q.dist(p2) - r2) <= 1e-5);
        out.push_back(q);
    }
}


ll n, k;
vector<Point<double>> p;
vector<double> c;

bool is_solution(const Point<double>& ans, double t){
    ll count = 0;
    REP(i, n){
        if(ans.dist(p.at(i)) * c.at(i) <= t + 1e-5){
            count++;
        }
    }
    return count >= k;
}

bool check(ll i, double t){
    return is_solution(p.at(i), t);
}

bool check(ll i, ll j, double t){
    vector<Point<double>> tmp;
    intersection_2circle(p.at(i), t / c.at(i), p.at(j), t / c.at(j), tmp);
    for(const auto q : tmp){
        if(is_solution(q, t)){
            return true;
        }
    }
    return false;
}

int main(){
    cin >> n >> k;
    p.resize(n); c.resize(n);
    REP(i, n){
        cin >> p.at(i).x >> p.at(i).y >> c.at(i);
    }

    double ans = continuous_binary_search(
        0, 1000 * sqrt(2) * 100,
        [&](double t) -> bool {
            REP(i, n){
                if(check(i, t)){
                    return true;
                }
            }
            REP(i, n){
                for(ll j = i + 1; j < n; ++j){
                    if(check(i, j, t)){
                        return true;
                    }
                }
            }
            return false;
        },
        false
    );
    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 384