#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1.0);
const double eps = 1e-8;
vector<pair<double, bool> > a;
double x[1100], y[1100], r[1100];
int n, k;
double sqr(double x) { return x * x; }
void add(double p, double q) {
  while (q > 2 * PI) {
    p -= 2 * PI;
    q -= 2 * PI;
  }
  while (p < 2 * PI) {
    a.push_back(make_pair(p + eps, 1));
    a.push_back(make_pair(q - eps, 0));
    p += 2 * PI;
    q += 2 * PI;
  }
}
int main() {
  int i, j;
  cin >> n >> k;
  for (i = 0; i < (n); i++) cin >> x[i] >> y[i] >> r[i];
  int best = min(2, n);
  for (i = 0; i < (n); i++) {
    a.clear();
    for (j = 0; j < (n); j++)
      if (i != j) {
        double ang = atan2(x[j] - x[i], y[j] - y[i]);
        double d = sqrt(sqr(x[j] - x[i]) + sqr(y[j] - y[i]));
        double a1 = asin((r[i] - r[j]) / d), a2 = asin((r[i] + r[j]) / d);
        a1 = PI / 2 - a1;
        a2 = PI / 2 - a2;
        add(ang - a1, ang - a2);
        add(ang + a2, ang + a1);
      }
    sort(a.begin(), a.end());
    int now = 1;
    for (j = 0; j < (a.size()); j++)
      if (a[j].second) {
        now++;
        best = max(best, now);
      } else
        now--;
  }
  long long ans = n;
  for (i = 0; i < (k); i++) ans += best + i;
  cout << ans << endl;
  return 0;
}
