#define _USE_MATH_DEFINES

#include <iostream>
#include <math.h>
#include <algorithm>
#include <functional> 
#include <string>
#include <vector>
#include <iomanip> //! for setprecision(10)

#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <utility>
#include <limits.h>
#include <math.h> 

#define rep(i,n) for (int i = 0; i < (n); ++i)

using namespace std;

typedef long long LL;


const double EPS = 0.0000000001;

bool equals(double a, double b) {
    return (fabs(a-b) < EPS);
}

struct Vector {
    double x;
    double y;
    explicit Vector(double _x = 0, double _y = 0) : x(_x), y(_y) {}

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

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

    Vector& operator*=(double ratio) {
        x *= ratio;
        y *= ratio;
        return *this;
    }

    Vector operator+(const Vector& rhs) const {
        Vector ret(*this);
        return ret+=rhs;
    }

    Vector operator-(const Vector& rhs) const {
        Vector ret(*this);
        return ret-=rhs;
    }

    Vector operator*(double ratio) const {
        Vector ret(*this);
        return ret*=ratio;
    }

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

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

    Vector rotateDeg(int deg) {
        double c = 0, s = 1.0;
        if (deg != 90) {
            double rad = M_PI * deg / 180.0;
            c = cos(rad);
            s = sin(rad);
        }
        return Vector(c*x-s*y, s*x+c*y);
    }
};




struct Circle {
    Vector o;
    double r;
    explicit Circle(double ox = 0, double oy = 0, double _r = 0) : o(ox, oy), r(_r) {}
    double area() const {
        return M_PI * r * r;
    }

    bool includes(const Vector& p) {
        return ((p-o).norm() <= r+EPS);
    }

    vector<Vector> intersections(const Circle& rhs) const {
        vector<Vector> ret;
        if (r < rhs.r) {
            //! we ensures rhs.r <= r
            ret = rhs.intersections(*this);
        } else {
            double dist = (o-rhs.o).norm();
            if (EPS < dist) {
                if (equals(dist, r+rhs.r) || equals(dist, r-rhs.r)) {
                    //! this and rhs touch with each other
                    ret.push_back(o + (rhs.o-o) * (r/dist));
                } else if (r-rhs.r < dist && dist < r+rhs.r) {
                    //! have two intersections
                    double x = (dist*dist + r*r - rhs.r*rhs.r) / (2.0*dist);
                    double y = sqrt(r*r - x*x);
                    Vector v1 = rhs.o-o; //! o to rhs.o
                    Vector v2 = v1 * (x / v1.norm()); //! o to the intersection of line o-rhs.o and the line connecting the two intersections of the circles
                    Vector v3 = (v1 * (y / v1.norm())).rotateDeg(90);
                    ret.push_back(o + v2 + v3);
                    ret.push_back(o + v2 - v3);
                }
            }
        }
        return ret;
    }
};

int main()
{
	cin.tie(0);
	ios::sync_with_stdio(0);

    int N, K;
    cin >> N >> K;
    vector<Circle> cs(N);
    vector<int> c(N);
    rep(i, N) {
        cin >> cs[i].o.x >> cs[i].o.y >> c[i];
    }

    double l = 0;
    double r = 2e5;
    rep(j, 50) {
        double m = (l+r)/2;
        //! judge if the number of Yakiniku that can be baked within m sec is gte K
        //! => judge if there is a point that is included in K circles where the ri = m/ci

        vector<Vector> candidates;

        rep(i, N) {
            cs[i].r = m / c[i];
            candidates.push_back(cs[i].o);
        }

        rep(x, N) rep(y, N) {
            if (x < y) {
                vector<Vector> is = cs[x].intersections(cs[y]);
                for (Vector v: is) candidates.push_back(v);
            }
        }

        bool ok = false;
        for (int i = 0; !ok && i < candidates.size(); ++i) {
            //! try all candidates points until we find an OK point or the candidates run out
            int cnt = 0;
            rep(k, N) {
                if (cs[k].includes(candidates[i])) ++cnt;
            }
            ok = (K <= cnt);
        }

        if (ok) {
            r = m;
        } else {
            l = m;
        }
    }

    cout << setprecision(10) << r << endl;

    return 0;
}


Measured memory_bytes: 384