#include <bits/stdc++.h>
using namespace std;
double error = 0.0000000001;
double corrige(double a) {
  while (a < -M_PI) a += M_PI + M_PI;
  while (a > M_PI) a -= M_PI + M_PI;
  return a;
}
vector<pair<double, int> > w;
void afegeix(pair<int, int> &p0, int r0, pair<int, int> &p1, int r1,
             int index) {
  int x = p1.first - p0.first;
  int y = p1.second - p0.second;
  double a = atan2(y, x);
  double m = sqrt(x * x + y * y);
  if (r0 == r1) {
    w.push_back(pair<double, int>(a, index));
    w.push_back(pair<double, int>(corrige(a + M_PI - error), -index));
  } else if (r0 < r1) {
    double aa = asin((r1 - r0) / m);
    double a1 = corrige(a - aa);
    double a2 = corrige((a + aa) + M_PI - error);
    w.push_back(pair<double, int>(a1, index));
    w.push_back(pair<double, int>(a2, -index));
  } else {
    double aa = asin((r0 - r1) / m);
    double a1 = corrige(a + aa);
    double a2 = corrige((a - aa) + M_PI - error);
    w.push_back(pair<double, int>(a1, index));
    w.push_back(pair<double, int>(a2, -index));
  }
  {
    double aa = asin((r0 + r1) / m);
    double a1 = corrige((a - aa) + M_PI);
    double a2 = corrige(a + aa - error);
    w.push_back(pair<double, int>(a1, index));
    w.push_back(pair<double, int>(a2, -index));
  }
}
int n;
vector<pair<int, int> > v;
vector<int> r;
void escriu() {
  for (int i = 0; i < int(w.size()); i++)
    cout << "(" << w[i].first << "," << w[i].second << ")";
  cout << endl;
}
int quants(int ibase) {
  w = vector<pair<double, int> >();
  for (int i = 0; i < n; i++)
    if (i != ibase) afegeix(v[ibase], r[ibase], v[i], r[i], i + 1);
  sort(w.begin(), w.end());
  {
    int tope = int(w.size());
    for (int i = 0; i < tope; i++) w.push_back(w[i]);
  }
  vector<int> aparece(n + 1, 0);
  int maximo = 0;
  int count = 0;
  for (int i = 0; i < int(w.size()); i++) {
    int index = w[i].second;
    if (index > 0) {
      if (not aparece[index]) {
        aparece[index] = 1;
        count++;
      }
    } else {
      if (aparece[-index]) {
        aparece[-index] = 0;
        count--;
      }
    }
    maximo = max(maximo, count);
  }
  return maximo + 1;
}
int main() {
  long long int k;
  cin >> n >> k;
  v = vector<pair<int, int> >(n);
  r = vector<int>(n);
  for (int i = 0; i < n; i++) cin >> v[i].first >> v[i].second >> r[i];
  long long int maxim = 0;
  for (int i = 0; i < n; i++) {
    long long int q = quants(i);
    maxim = max(maxim, n + k * (k + 1) / 2 + k * (q - 1));
  }
  cout << maxim << endl;
}
