#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  if (n == 2) {
    cout << 3 << " " << 3 << endl;
    cout << 1 << " " << 2 << " " << 3 << endl;
    return 0;
  }
  int prime = 430411;
  cout << 3 << " " << prime << endl;
  for (int i = 2; i < n - 1; i++) {
    cout << 1 << " " << i << " " << 1 << endl;
  }
  cout << 1 << " " << n - 1 << " " << prime - n << endl;
  cout << 1 << " " << n << " " << 3 << endl;
  m -= (n - 1);
  for (int i = 2; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (m == 0) break;
      m--;
      cout << i << " " << j << " " << prime + 1 << endl;
    }
  }
  return 0;
}
