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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int,int,int> tpl;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);--i)
#define RREP(i,n) RFOR(i,n,0)

const double EPS = 1e-9;
const double PI  = acos(-1.0);
const int INT_INF = 2147483647;
const long long LL_INF = 1LL<<60;
const long long MOD = 1000000007;

#define CLR(a) memset((a), 0 ,sizeof(a))

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

struct V {
    double x,y;
    V(double x=0, double y=0): x(x), y(y) {}

    V& operator += (const V& v) { x += v.x; y += v.y; return *this;}
    V operator + (const V& v) const { return V(*this) += v;}
    V& operator -= (const V& v) { x -= v.x; y -= v.y; return *this;}
    V operator - (const V& v) const { return V(*this) -= v;}
    V& operator *= (double s) { x *= s; y *= s; return *this;}
    V operator * (double s) const { return V(*this) *= s;}
    V& operator /= (double s) { x /= s; y /= s; return *this;}
    V operator / (double s) const { return V(*this) /= s;}

    double dot(const V& v) const { return x*v.x + y*v.y;}
    double norm2() const { return x*x + y*y;}
    double norm() const { return sqrt(norm2());}
    V& rotate(double theta) { x = x*cos(theta)-y*sin(theta); y = x*sin(theta)+y*cos(theta); return *this;}
    V rotate90() { return V(-y, x);}
};

struct Circle {
    V o; double r;
    Circle(V o=V(), double r=0): o(o), r(r) {}

    vector<V> get_intersection(const Circle& c){
        V v = c.o - o;
        double d = v.norm();

        if(r + c.r < d + EPS) return {};
        if(d < abs(r - c.r) + EPS) return {};
        if(abs(d - (r + c.r)) < EPS) return vector<V>{v*(r/d) + o};
        if(abs(d - abs(r - c.r)) < EPS) return vector<V>{v*(max(r,c.r)/d) + o};

        double x = (r*r - c.r*c.r + d*d) / (2*d), l = sqrt(r*r - x*x);
        V v1 = v*(x/d), v2 = v1.rotate90()*(l/x);
        return vector<V>{v1+v2+o, v1-v2+o};
    }

    bool isInside(const V& v) {
        return (v-o).norm() < r + EPS;
    }
};

int main(void){
    int N,K; cin >> N >> K;
    vector<double> x(N), y(N), c(N); REP(i,N) cin >> x[i] >> y[i] >> c[i];
    if(K == 1){
        cout << 0 << endl;
        return 0;
    }
    vector<Circle> cir(N);
    REP(i,N){
        V v(x[i], y[i]);
        cir[i].o = v;
    }
    double l = 0, r = 200000, T = (l+r)/2;
    REP(z,100){
        REP(i,N) cir[i].r = T / c[i];
        vector<V> v;
        REP(i,N) v.push_back(cir[i].o);
        REP(i,N-1)FOR(j,i+1,N){
            auto ip = cir[i].get_intersection(cir[j]);
            v.insert(v.end(), ip.begin(), ip.end());
        }
        bool flag = true;
        REP(i,v.size()){
            int tmp = 0;
            REP(j,N) if(cir[j].isInside(v[i])) tmp++;
            if(K <= tmp){
                flag = false;
                break;
            }
        }
        if(flag) l = T;
        else r = T;
        T = (l+r)/2;
    }
    double ans = r;
    cout << fixed << setprecision(8) << ans << endl;
    return 0;
}

Measured memory_bytes: 384