#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  if (flag) x = -x;
}
int n, k, cnt, tot;
double ans;
double v[500010];
map<pair<long long, long long>, int> mp;
vector<pair<long long, long long> > ve[500010];
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
double dis(pair<long long, long long> a) {
  return sqrt(a.first * a.first + a.second * a.second);
}
bool cmp(const pair<long long, long long> &a,
         const pair<long long, long long> &b) {
  return dis(a) > dis(b);
}
void work(int id) {
  sort(ve[id].begin(), ve[id].end(), cmp);
  int num = ve[id].size();
  for (int i = 1; i <= min(num, (k + 1) / 2); ++i)
    v[++tot] = (k - 2 * i + 1) * dis(ve[id][i - 1]);
  double sum = 0;
  for (int i = (k + 1) / 2 + 1; i <= min(num, k); ++i)
    v[++tot] =
        (k - 2 * ((k + 1) / 2 + 1) + 1) * dis(ve[id][num - (i - (k + 1) / 2)]) -
        2 * sum,
    sum += dis(ve[id][num - (i - (k + 1) / 2)]);
}
int main() {
  read(n), read(k), v[tot = 1] = 0;
  for (int i = 1; i <= n; ++i) {
    long long x, y, g;
    read(x), read(y), g = gcd(abs(x), abs(y));
    if (!x && !y) continue;
    if (!mp.count({x / g, y / g})) mp[{x / g, y / g}] = ++cnt;
    ve[mp[{x / g, y / g}]].push_back({x, y});
  }
  for (int i = 1; i <= cnt; ++i) work(i);
  sort(v + 1, v + tot + 1);
  for (int i = 1; i <= k; ++i) ans += v[tot - i + 1];
  printf("%.10lf", ans);
  return 0;
}
