#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vi2;
typedef vector<vi2> vi3;
typedef pair<int, int> pii;
typedef vector<pii> vii;
typedef vector<ll> vll;
typedef vector<vll> vll2;
typedef vector<vll2> vll3;
typedef vector<bool> vb;

#define el '\n'
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repi(i, a, b) for (int i = a; i >= b; i--)
#define umap unordered_map
#define uset unordered_set
#define vec vector
#define loop(a) for (auto &x : a)
#define all(a) a.begin(), a.end()
#define mp make_pair

const double eps = 1e-6;

int n, k;
vi x, y, c;

double sqr(double z) {
    return z * z;
}

int count(double xx, double yy, vec<double> &r) {
    int ans = 0;
    rep(i, 0, n) {
        double work = sqr(xx - x[i]) + sqr(yy - y[i]);
        if (work < sqr(r[i]) + eps) {
            ans++;
        }
    }
    return ans;
}

vec<pair<double, double>> intersection(int i, int j, vec<double> &r) {
    vec<pair<double, double>> ans;
    double c2c = sqrt(sqr(x[i] - x[j]) + sqr(y[i] - y[j]));
    if (c2c + eps < abs(r[i] - r[j]) || c2c > r[i] + r[j] + eps) {
        return ans;
    }
    if (x[i] > x[j] || (x[i] == x[j] && y[i] > y[j])) {
        swap(i, j);
    }
    // if (sqr(r[i]) + sqr(c2c) < sqr(r[j]) + eps) {
    //     return ans;
    // }
    double cos_alpha = (sqr(r[i]) + sqr(c2c) - sqr(r[j])) / (2 * r[i] * c2c);
    double alpha = acos(cos_alpha);
    double sin_alpha = sin(alpha); // sqrt(1 - sqr(cos_alpha));
    double a = r[i] * sin_alpha;
    double b = r[i] * cos_alpha;
    if (y[i] == y[j]) {
        ans.emplace_back(x[i] + b, y[i] + a);
        ans.emplace_back(x[i] + b, y[i] - a);
    } else if (x[i] == x[j]) {
        ans.emplace_back(x[i] - a, y[i] + b);
        ans.emplace_back(x[i] + a, y[i] + b);
    } else {
        double slope = (double) (y[i] - y[j]) / (x[i] - x[j]);
        double x0 = x[i] + (x[j] - x[i]) * b / c2c;
        double y0 = y[i] + (y[j] - y[i]) * b / c2c;
        double slope2 = -1 / slope;
        double d = a / sqrt(1 + sqr(slope2));
        if (y[i] < y[j]) {
            d = -d;
        }
        double x1 = x0 + d;
        double x2 = x0 - d;
        double y1 = y0 + slope2 * d;
        double y2 = y0 - slope2 * d;
        ans.emplace_back(x1, y1);
        ans.emplace_back(x2, y2);
    }
    return ans;
}

bool ok(double t) {
    vec<double> r(n);
    rep(i, 0, n) {
        r[i] = t / c[i];
    }
    rep(i, 0, n) {
        if (count(x[i], y[i], r) >= k) {
#ifdef LOCAL
            cout << "good point(center): " << x[i] << ' ' << y[i] << el;
#endif
            return true;
        }
        rep(j, i + 1, n) {
            vec<pair<double, double>> work = intersection(i, j, r);
#ifdef LOCAL
            if (work.size() > 0) {
                cout << "intersection between " << i << " and " << j << ": "
                     << work[0].first << ',' << work[0].second << ' '
                     << work[1].first << ',' << work[1].second << el;
            }
#endif
            for (auto p : work) {
                if (count(p.first, p.second, r) >= k) {
#ifdef LOCAL
                    cout << "good point: " << p.first << ' ' << p.second << el;
#endif
                    return true;
                }
            }
        }
    }
    return false;
}

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

    cin >> n >> k;
    x = vi(n), y = vi(n), c = vi(n);
    rep(i, 0, n) {
        cin >> x[i] >> y[i] >> c[i];
    }
    double low = 0, high = 1e6;
    rep(i, 0, 100) {
        double mid = (low + high) / 2;
        if (ok(mid)) {
            high = mid;
        } else {
            low = mid;
        }
    }
    cout << fixed << setprecision(10);
    cout << low << el;
}


Measured memory_bytes: 384