n,k = map(int,input().split())
a = [list(map(int,input().split())) for i in range(n)]
dp = [[[10**18 for h in range(k+1)] for i in range(n)] for j in range(1<<n)]
import math
def dist(a,b,c,d):
    return math.sqrt((a-c)**2 + (b-d)**2)
for i in range(n):
    dp[1<<i][i][k-1] = dist(a[i][0],a[i][1],0,0)
for s in range(1<<n):
    for i in range(n):
        if(s >> i) & 1 == 0:
            continue
        for j in range(n):
            if(s >> j) & 1 == 1:
                continue
            for l in range(k+1):
                if l != 0:
                    dp[s+(1<<j)][j][l-1] = min(dp[s+(1<<j)][j][l-1],dp[s][i][l] + dist(a[i][0],a[i][1],a[j][0],a[j][1]))
                dp[s+(1<<j)][j][k-1] = min(dp[s+(1<<j)][j][k-1],dp[s][i][l] + dist(a[i][0],a[i][1],0,0) + dist(0,0,a[j][0],a[j][1]))
ans = 10**18
for i in range(n):
    for j in range(k+1):
        ans = min(ans,dp[(1<<n)-1][i][j]+dist(0,0,a[i][0],a[i][1]))
print(ans)