#include <bits/stdc++.h>
using namespace std;
bool is_prime(int n) {
  if (n < 2) return false;
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) return false;
  return true;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  int way = n - 1;
  while (!is_prime(way)) {
    ++way;
  }
  cout << way << " " << way << endl;
  cout << 1 << " " << 2 << " " << 1 + way - (n - 1) << endl;
  for (int i = 2; i <= n - 1; ++i)
    cout << i << " " << i + 1 << " " << 1 << '\n';
  int left = m - (n - 1);
  for (int i = 1; i <= n && left > 0; ++i)
    for (int j = i + 2; j <= n && left > 0; ++j) {
      cout << i << " " << j << " " << (int)1e9 << '\n';
      --left;
    }
  return 0;
}
