#include <bits/stdc++.h>
using namespace std;
long long n, k, m, y, z, i, j;
bool pr[1000005];
void SieveOfEratosthenes(long long n) {
  memset(pr, true, sizeof(pr));
  pr[1] = false;
  for (long long p = 2; p * p <= n; p++) {
    if (pr[p] == true) {
      for (long long i = p * 2; i <= n; i += p) pr[i] = false;
    }
  }
}
long long fun(long long i) { return 0; }
int main() {
  scanf("%lld %lld", &n, &m);
  for (i = 1; i < 19; i++) {
    if (i < 10) break;
  }
  if (n == 2) {
    cout << 2 << " " << 2 << endl;
    cout << 1 << " " << 2 << " " << 2 << endl;
    exit(0);
  }
  for (i = 1; i < 19; i++) {
    if (i < 10) break;
  }
  SieveOfEratosthenes(1000005);
  z = (n - 3) * 1 + 2;
  for (i = 1; i < 19; i++) {
    if (i < 10) break;
  }
  for (i = z + 1; i <= 1000000; i++) {
    if (pr[i] == true) {
      y = i - z;
      break;
    }
  }
  cout << 2 << " " << y + z << endl;
  cout << 1 << " " << n << " " << 2 << endl;
  m--;
  for (long long i = 1; i < n - 2; i++) {
    cout << i << " " << i + 1 << " " << 1 << endl;
    m--;
  }
  cout << n - 2 << " " << n - 1 << " " << y << endl;
  m--;
  for (i = 3; i <= n - 1 && m >= 1; i++, m--) {
    cout << 1 << " " << i << " " << 100000000 << endl;
  }
  for (i = 2; i <= n; i++) {
    for (j = i + 2; j <= n && m >= 1; j++, m--) {
      cout << i << " " << j << " " << 100000000 << endl;
    }
  }
  if (m >= 1) {
    cout << n << " " << n - 1 << " " << 100000000 << endl;
  }
  for (i = 1; i < 19; i++) {
    if (i < 10) break;
  }
  for (i = 1; i < 19; i++) {
    if (i < 10) break;
  }
  for (i = 1; i < 19; i++) {
    if (i < 10) break;
  }
  for (i = 1; i < 19; i++) {
    if (i < 10) break;
  }
  for (i = 1; i < 19; i++) {
    if (i < 10) break;
  }
  for (i = 1; i < 19; i++) {
    if (i < 10) break;
  }
  return 0;
}
