#include <bits/stdc++.h>
using std::map;
using std::queue;
using std::set;
using std::string;
using std::vector;
const double kEps = 10e-8;
const int kMax = 500000;
const int kInf = 1 << 30;
vector<int> primes;
void init() {
  std::bitset<kMax> sieve;
  sieve.set();
  int sr = std::sqrt(kMax);
  for (int i = 2; i <= sr; i++) {
    if (sieve.test(i)) {
      for (int j = i * i; j < kMax; j += i) {
        sieve.reset(j);
      }
    }
  }
  for (int i = 2; i < kMax; i++) {
    if (sieve.test(i)) {
      primes.push_back(i);
    }
  }
}
int main() {
  init();
  int n, m;
  std::cin >> n >> m;
  int target = 0;
  for (int p : primes) {
    if (p >= (2 * (n - 1))) {
      target = p;
      break;
    }
  }
  vector<int> mst(n - 1, 2);
  int x = target - ((n - 2) * 2);
  mst[0] = x;
  std::cout << 2 << " " << std::accumulate(mst.begin(), mst.end(), 0)
            << std::endl;
  int edge = 0;
  for (int u = 0; u < n; u++) {
    if (edge >= m) {
      break;
    }
    for (int v = u + 1; v < n && edge < m; v++) {
      if (edge < int(mst.size())) {
        std::cout << (u + 1) << " " << (v + 1) << " " << mst[edge] << "\n";
      } else {
        std::cout << (u + 1) << " " << (v + 1) << " " << x + 1 << "\n";
      }
      edge++;
    }
  }
  return EXIT_SUCCESS;
}
