#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void cmin(T &a, T b) {
  ((a > b) && (a = b));
}
template <class T>
inline void cmax(T &a, T b) {
  ((a < b) && (a = b));
}
char IO;
template <class T = int>
T rd() {
  T s = 0;
  int f = 0;
  while (!isdigit(IO = getchar())) f |= IO == '-';
  do s = (s << 1) + (s << 3) + (IO ^ '0');
  while (isdigit(IO = getchar()));
  return f ? -s : s;
}
const int N = 5e5 + 10, INF = 1e9 + 10;
int n, m, c;
map<pair<int, int>, int> M;
vector<double> G[N];
int cnt[N], L[N], R[N];
double s[N];
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
priority_queue<pair<double, int> > que;
void Push(int i) {
  if (L[i] > R[i]) return;
  if (cnt[i] > 0) {
    que.push(make_pair(G[i][R[i]--] * cnt[i], i));
    cnt[i] -= 2;
  } else {
    que.push(make_pair(G[i][L[i]] * cnt[i] + s[i], i));
    s[i] -= 2 * G[i][L[i]++];
  }
}
int main() {
  n = rd(), m = rd();
  for (int i = 1, iend = n; i <= iend; ++i) {
    int x = rd(), y = rd(), g = max(1, abs(gcd(x, y)));
    int &u = M[make_pair(x / g, y / g)];
    if (!u) u = ++c;
    G[u].push_back(sqrt(1ll * x * x + 1ll * y * y));
  }
  for (int i = 1, iend = c; i <= iend; ++i)
    sort(G[i].begin(), G[i].end()), R[i] = G[i].size() - 1, cnt[i] = m - 1,
                                    Push(i);
  double ans = 0;
  while (m--) {
    ans += que.top().first;
    int i = que.top().second;
    que.pop();
    Push(i);
  }
  printf("%.10lf\n", ans);
}
