#include <bits/stdc++.h>
using namespace std;
void dout() { cerr << endl; }
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
  cerr << H << ' ';
  dout(T...);
}
using long long = long long;
using pii = pair<long long, long long>;
using ld = long double;
using pll = pair<long long, long long>;
void precalc() {}
template <class T>
T rnd(T l, T r) {
  using D = uniform_int_distribution<T>;
  static random_device rd;
  static mt19937 gen(rd());
  return D(l, r - 1)(gen);
}
const int MAXN = 1000;
int n;
int k;
ld eps = 1e-8;
ld coef[MAXN];
pair<ld, ld> pts[MAXN];
ld ff(ld x, ld y) {
  vector<ld> times;
  for (int i = 0; i < n; ++i) {
    ld dx = abs(x - pts[i].first);
    ld dy = abs(y - pts[i].second);
    times.push_back(coef[i] * sqrt(dx * dx + dy * dy));
  }
  sort(times.begin(), times.end());
  return times[k - 1];
}
ld f(ld x) {
  ld left = -1111;
  ld right = 1111;
  while (true) {
    ld ml = (2 * left + right) / 3;
    ld mr = (left + 2 * right) / 3;
    ld vall = ff(x, ml);
    ld valr = ff(x, mr);
    if (vall > valr) {
      left = ml;
    } else {
      right = mr;
    }
    if (abs(left - right) < eps) break;
  }
  return ff(x, (left + right) / 2);
}
ld calc(ld left, ld right) {
  while (true) {
    ld ml = (2 * left + right) / 3;
    ld mr = (left + 2 * right) / 3;
    ld vall = f(ml);
    ld valr = f(mr);
    if (vall > valr) {
      left = ml;
    } else {
      right = mr;
    }
    if (abs(left - right) < eps) break;
  }
  return f((left + right) / 2);
}
void solve() {
  cin >> n;
  cin >> k;
  vector<ld> xx;
  for (int i = 0; i < n; ++i) {
    ld x, y, c;
    cin >> x >> y >> c;
    pts[i] = {x, y};
    coef[i] = c;
    xx.push_back(x);
  }
  sort(xx.begin(), xx.end());
  ld answr = 1e18;
  if (n == 1) answr = 0;
  for (int i = 0; i < n - 1; ++i) {
    answr = min(answr, calc(xx[i], xx[i + 1]));
  }
  cout << answr;
}
void multisolve() {
  int t;
  cin >> t;
  while (t--) solve();
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr), cout.tie(nullptr);
  cout << fixed << setprecision(20);
  precalc();
  solve();
}
