#include <iostream>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <cassert>

#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define eb emplace_back

typedef long long ll;
using namespace std;

long double add(long double a,long double b){
    if(abs(a+b) < 1e-14 * (abs(a) + abs(b))) return 0;
    else return a + b;
}
constexpr long double EPS = 1e-14;
constexpr long double PI = 3.141592653589793237462;
struct V{
    long double x,y;
    long double add(long double a,long double b){
        if(abs(a+b) < EPS * (abs(a) + abs(b))) return 0;
        else return a + b;
    }
    ///////////////////////////////////////////////////
    V(long double x = 0.0,long double y = 0.0):x(x),y(y){}
    V& operator+=(const V& a){x=add(x,a.x),y=add(y,a.y);return *this;}
    V& operator-=(const V& a){x=add(x,-a.x),y=add(y,-a.y);return *this;}
    V& operator*=(const long double& a){x*=a,y*=a;return *this;}
    V  operator+(const V& b) const{V a(*this);return a+= b;}
    V  operator-(const V& b) const{V a(*this); return a-=b;}
    V  operator*(const long double& b) const{V a(*this); return a*= b;}
    bool  operator<(V& b){return getarg() > b.getarg();}
    long double dot(V b){return add(x * b.x,y * b.y);}
    long double det(V b){return add(x * b.y , -y * b.x);}
    long double norm(){return sqrt(add(x*x , y*y));}
    V  round(long double deg,bool argument = false){//弧度法で入力する時はargument = true
        long double arg = (argument ? deg : PI*(deg/180.0)) ;
        if(argument == true) arg = deg;else arg = PI * (deg / 180.0);
        return V(add(x * cos(arg),-y * sin(arg)),add(x * sin(arg),y * cos(arg)));
    }
    V get_unit(){
        return V(x / norm(),y / norm());
    }
    long double getarg(){
        return atan2(y,x);// [PI,-PI]
    }
    friend ostream& operator<<(ostream& os,V& p){
        os << fixed << setprecision(20);
        os << "(" << p.x << "," << p.y << ")";
        return os;
    }
};
struct GeoUtil{
    long double add(long double a,long double b){
        if(abs(a+b) < EPS * (abs(a) + abs(b))) return 0;
        else return a + b;
    }
    long double dist(V a,V b){
        V v = a - b;
        return v.norm();
    }
};
struct C{
    V c;
    long double r;
    C(long double x = 0.0,long double y = 0.0,long double r = 0.0):c(x,y),r(r){}
    pair<V,V> cross(const C& b){
        GeoUtil GU;
        long double r1 = r,r2 = b.r;
        V v_1 = b.c - c;
        long double d = v_1.norm();
        long double x = add(add(r1*r1,-r2*r2),d*d)/(2.0*d);
        long double ratio = x / d;
        V v_2 = v_1 * ratio;
        V p = c + v_2;
        V v_3 = v_2.round(90.0);
        v_3 = v_3.get_unit();
        long double r3 = sqrt(add(r1*r1,-x*x));
        v_3 = v_3 * r3;
        V ans1 = p + v_3;
        V ans2 = p - v_3;
        V check = ans1 - c;
        return make_pair(ans1,ans2);
    }
};
int N,K;
long double x[60],y[60],c[60];
C a[60];

bool included(C c1,C c2){
   GeoUtil GU; 
   return GU.dist(c1.c , c2.c) + c2.r < c1.r;
}
bool far_away(C c1,C c2){
   GeoUtil GU; 
   return GU.dist(c1.c , c2.c) > c1.r + c2.r;
}
bool can_bake(V p,C q){
    GeoUtil GU;
    return  GU.dist(p,q.c) - 1e-10 < q.r;
}
bool judge(vector<V>& cand){
   GeoUtil GU;
   for(auto p : cand){
       int cnt = 0;
       for(int i = 0;i < N;i++){
           if(can_bake(p,a[i]))cnt++;
       }
       if(cnt >= K)return true;
   }
   return false;
}
bool func(double T){
    for(int i = 0;i < N;i++){
        a[i] = C(x[i],y[i],T/c[i]);
    }
    vector<V> cand;
    for(int i = 0;i < N;i++){
        cand.push_back(a[i].c);
    }
    for(int i = 0;i < N-1;i++){
        for(int j = i+1;j < N;j++){
            if(included(a[i],a[j]) || included(a[j],a[i]) || far_away(a[i],a[j])){
                continue;
            }
            else{
                V v1 = a[j].cross(a[i]).first;
                V v2 = a[j].cross(a[i]).second;
                cand.push_back(v1);
                cand.push_back(v2);
            }
        }
    }
    return judge(cand);
}
void solve(){
    cin >> N >> K;
    for(int i = 0;i < N;i++){
        cin >> x[i] >> y[i] >> c[i];
    }
    GeoUtil GU;
    long double lb = 0,ub = 4e6;
    for(int i = 0;i < 100;i++){
        long double mid = (lb + ub)*0.5;
        if(func(mid)) ub = mid;
        else lb = mid;
    }
    cout << (lb + ub)*0.5 << '\n';
}
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed  << setprecision(6);
    solve();
    
}


Measured memory_bytes: 384