#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int x, long long int y) {
  if (x % y) return gcd(y, x % y);
  return y;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, k;
  cin >> n >> k;
  vector<long double> g[n + 1];
  vector<pair<pair<long long int, long long int>, long double>> t;
  int j = 0, o = 1;
  long long int x, y, qw;
  pair<pair<long long int, long long int>, long double> temp;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    long long int x1 = abs(x);
    long long int y1 = abs(y);
    if (y != 0)
      qw = gcd(x1, y1);
    else if (x != 0)
      qw = x1;
    else
      continue;
    long double r = sqrtl(x * x + y * y);
    x /= qw;
    y /= qw;
    temp.first.first = x;
    temp.first.second = y;
    temp.second = r;
    t.push_back(temp);
  }
  sort(t.begin(), t.end());
  --n;
  for (int i = 0; i < n; i = j) {
    while (j < n && t[j].first == t[i].first) ++j;
    for (int z = i; z < j; ++z) g[o].push_back(t[z].second);
    ++o;
  }
  ++n;
  j = o;
  long double ans = 0;
  vector<long double> s;
  for (int i = 1; i < j; ++i) {
    long double z = k - 1;
    int f = g[i].size();
    --f;
    for (; ((z > 0) && (f >= 0)); --f) {
      s.push_back(z * g[i][f]);
      z -= 2.0;
    }
    long double aq = 0, gq;
    if (z == 0)
      gq = 0;
    else
      gq = 1;
    for (int l = 0; l <= f; ++l) {
      s.push_back(2.0 * aq - gq * g[i][l]);
      aq -= g[i][l];
    }
  }
  cout << fixed << setprecision(12);
  s.push_back(0);
  sort(s.begin(), s.end());
  for (int i = n - 1, u = 0; u < k && i > -1; ++u, --i) ans += s[i];
  cout << ans;
  return 0;
}
