#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <complex>
#include <vector>
#include<limits>
#include<iomanip>

using namespace std;

#define debug(x) cout << #x << ": " << x << endl;
#define ll long long
#define mod 1000000007

// #define COMMENT

struct Circle {
  int xc, yc;
  double ra;
} circles[100];

int N, K;

double square(double num) {
  return num * num;
}

bool xyInCircle(double xc,double yc, Circle circle, double T, double thresh = 0) {
  double x2 = square(circle.xc - xc);
  double y2 = square(circle.yc - yc);
  double r2 = square(T / circle.ra);

  // cout << x2 + y2 - r2 << endl;
  return x2 + y2 - r2 <= thresh;
}

vector<double> findIntersection(Circle circle1, Circle circle2, double T,
  double thresh = 0) {

    vector<double> coords;

    int x1 = circle1.xc;
    int y1 = circle1.yc;
    int x2 = circle2.xc;
    int y2 = circle2.yc;

    double r1 = T / circle1.ra;
    double r2 = T / circle2.ra;

    int c1c2_2 = square(circle1.xc-circle2.xc)
                 + square(circle1.yc-circle2.yc);

    if(abs(c1c2_2 - square(r1 + r2)) <= thresh) { // touch outside

      double xi = (r1*x2 + r2*x1)/(r1+r2);
      double yi = (r1*y2 + r2*y1)/(r1+r2);
      coords.push_back(xi);coords.push_back(yi);

    } else if(abs(c1c2_2 - square(r1 - r2)) <= thresh) { // touch inside

      double xi = (r1*x2 - r2*x1)/(r1-r2);
      double yi = (r1*y2 - r2*y1)/(r1-r2);
      coords.push_back(xi);coords.push_back(yi);

    } else if(c1c2_2 > square(r1 + r2)) { // mutually exclusive

    } else if(c1c2_2 < square(r1 - r2)) { // 1 inside another

    } else { // intersect at 2 points

      double l = sqrt(c1c2_2);
      double a = (square(r1)-square(r2)+square(l))/(2*l);

      double zx = (x2-x1)/l;
      double zy = (y2-y1)/l;

      double xd = (a*x2+(l-a)*x1)/l;
      double yd = (a*y2+(l-a)*y1)/l;

      double x = xd-zy*sqrt(square(r1)-square(a));
      double y = yd+zx*sqrt(square(r1)-square(a));

      coords.push_back(x);coords.push_back(y);

      x = xd+zy*sqrt(square(r1)-square(a));
      y = yd-zx*sqrt(square(r1)-square(a));

      coords.push_back(x);coords.push_back(y);

    }

    return coords;
}

bool greaterThanEqualToK(Circle circles[], double T, double thresh = 0) {

  for(int i = 0;i < N;i++) {
    double x = circles[i].xc;
    double y = circles[i].yc;
    int counter = 0;

    for(int j = 0;j < N;j++) {
      if(xyInCircle(x, y, circles[j], T, thresh)) {
        counter++;
      }
    }

    if(counter >= K) {
      return true;
    }
  }

  #ifdef COMMENTS
  cout << "Phase 2" << endl;
  #endif

  for(int i = 0;i < N;i++) {
    for(int j = i + 1;j < N;j++) {

      vector<double> intersectPoints
                     = findIntersection(circles[i], circles[j], T, thresh);

      #ifdef COMMENTS
      for(auto co : intersectPoints) {
        debug(co);
      }
      #endif

      for(int k = 0;k < intersectPoints.size();k += 2) {
        double x = intersectPoints[k];
        double y = intersectPoints[k+1];
        int counter = 0;

        for(int p = 0;p < N;p++) {
          if(xyInCircle(x, y, circles[p], T, thresh)) {
            counter++;
          }
        }

        if(counter >= K) {

          #ifdef COMMENTS
          debug(i);
          debug(j);
          debug(k);
          #endif
          // debug(counter);
          return true;
        } else {
          // debug(counter);
        }
      }
    }
  }

  return false;
}

int main() {

//  freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);


  // #define COMMENTS
  cin >> N >> K;
  for(int i = 0;i < N;i++) {
    cin >> circles[i].xc >> circles[i].yc >> circles[i].ra;
  }

  #ifndef COMMENTS
  double lo = 0, hi = 300099, mid;
  while ((hi - lo) >= 1e-7) {
    mid = (lo + hi)/2;

    // debug(lo);
    // debug(mid);
    // debug(hi);

    if(greaterThanEqualToK(circles, mid, 0.0000001)) {
      hi = mid;
    } else {
      lo = mid;
    }

    // if(abs(2.57577-mid) < 0.00001) {
    //   debug(mid);
    //   debug(lo);break;
    // }
  }
  #endif



  #ifdef COMMENTS
  cout << greaterThanEqualToK(circles, 2.57577, 0) << endl;
  #endif

  cout << fixed << setprecision(10);
  #ifndef COMMENTS
  cout << (lo + hi)/2 << endl;
  #endif


  return 0;
}


Measured memory_bytes: 256