#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, p, t;
  double x, y, dis, l;
  map<double, int> mp;
  cin >> n >> m;
  while (n--) {
    cin >> x >> y >> p;
    dis = x * x + y * y;
    dis = sqrt(dis);
    mp[dis] += p;
  }
  for (auto it : mp) {
    l = it.first;
    t = it.second;
    m += t;
    if (m >= 1000000) return cout << setprecision(9) << fixed << l, 0;
  }
  cout << "-1";
}
