#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-8;
const double PI = acos(-1);
double x[2005] = {0};
double y[2005] = {0};
double r[2005] = {0};
int main() {
  long n, k, i, j;
  long best = 1;
  cin >> n >> k;
  for (i = 1; i <= n; i++) cin >> x[i] >> y[i] >> r[i];
  for (i = 1; i <= n; i++) {
    vector<pair<double, long> > a;
    for (j = 1; j <= n; j++)
      if (i != j) {
        double d = sqrt(((x[i]) - (x[j])) * ((x[i]) - (x[j])) +
                        ((y[i]) - (y[j])) * ((y[i]) - (y[j])));
        double alpha = atan2(y[j] - y[i], x[j] - x[i]);
        double beta = asin((r[i] - r[j]) / d);
        double gama = asin((r[i] + r[j]) / d);
        beta = PI / 2 - beta;
        gama = PI / 2 - gama;
        for (double angle = -2 * PI; angle < 2 * PI; angle += 2 * PI) {
          a.push_back(pair<double, long>(alpha - beta + angle + eps, 1));
          a.push_back(pair<double, long>(alpha - gama + angle - eps, -1));
          a.push_back(pair<double, long>(alpha + gama + angle + eps, 1));
          a.push_back(pair<double, long>(alpha + beta + angle - eps, -1));
        }
      }
    sort(a.begin(), a.end());
    long now = 0;
    for (j = 0; j < a.size(); j++) {
      now += a[j].second;
      if (now + 1 > best) best = now + 1;
    }
  }
  cout << 1LL * k * (k + 1) / 2 + 1LL + (1LL * best - 1) * (1LL * k + 1) + n -
              best
       << endl;
  return 0;
}
