'''
有k个卫星其实就是可以有k-1条费用为0的边,所以组成最小生成树只需要原来的n-1-(k-1)条边即可,
跑一遍Kruthcal,总共最多允许加n-1-(k-1)条边,取最后一条边的长度即可
'''
import math
class MergeSet:
def __init__(self):
self.m = {}
self.__root_cnt = 0
def getRoot(self, node):
root = node
buf = []
while self.m[root] != root:
buf.append(root)
root = self.m[root]
for node in buf:
self.m[node] = root
return root
def merge(self, a, b):
for node in [a, b]:
if node not in self.m:
self.m[node] = node
self.__root_cnt += 1
root1 = self.getRoot(a)
root2 = self.getRoot(b)
if root1 != root2:
self.m[root1] = root2
self.__root_cnt -= 1
def isInSameSet(self, a, b):
if a == b:
return True
for node in [a, b]:
if node not in self.m:
return False
return self.getRoot(a) == self.getRoot(b)
def getRootNum(self):
return self.__root_cnt
def getClusters(self):
rec = {}
for node in self.m:
root = self.getRoot(node)
if root not in rec:
rec[root] = []
rec[root].append(node)
return [nodes for nodes in rec.values()]
def getMinSpanTreeKruscal(edges, max_edges):
if len(edges) == 0:
return [None, None]
edge_list = [(w, a, b) for a, b, w in edges]
edge_list.sort()
merge_set = MergeSet()
span_tree = []
sum = 0
for w, a, b in edge_list:
if merge_set.isInSameSet(a, b):
continue
merge_set.merge(a, b)
span_tree.append((a, b))
sum += w
if len(span_tree) == max_edges:
return math.sqrt(w)
return 0
n, k = map(int, input().split())
points = []
for _ in range(n):
x, y = map(int, input().split())
points.append((x, y))
edges = []
for i in range(n):
for j in range(i+1, n):
x1, y1 = points[i]
x2, y2 = points[j]
edges.append( (i, j, (x1-x2)**2 + (y1-y2)**2) )
print('{:.2f}'.format(getMinSpanTreeKruscal(edges, n-1-(k-1))))