#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> isprime(1000001, true);
  isprime[0] = isprime[1] = false;
  for (int i = 2; i * i <= 1000000; i++)
    if (isprime[i])
      for (int j = i * i; j <= 1000000; j += i) isprime[j] = false;
  int sp = n - 1;
  while (!isprime[sp]) sp++;
  cout << sp << " " << sp << endl;
  cout << 1 << " " << 2 << " " << sp - n + 2 << endl;
  for (int i = 2; i <= n - 1; i++)
    cout << i << " " << i + 1 << " " << 1 << endl;
  m -= n - 1;
  for (int i = 1; i <= n && m > 0; i++)
    for (int j = i + 2; j <= n && m > 0; j++) {
      cout << i << " " << j << " " << 10000000 << endl;
      m--;
    }
  return 0;
}
