#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 50;
bool is[N];
vector<int> pri;
int main() {
  ios_base ::sync_with_stdio(0);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 2; i <= 1e5 + 5; ++i) {
    if (!is[i]) {
      pri.push_back(i);
      for (int j = i + i; j <= 1e5 + 5; j += i) {
        is[j] = 1;
      }
    }
  }
  int p = *upper_bound(pri.begin(), pri.end(), n);
  cout << p << ' ' << p << endl;
  for (int i = 1; i < n - 1; ++i) {
    cout << i << ' ' << i + 1 << ' ' << 1 << endl;
    --p;
  }
  cout << n - 1 << ' ' << n << ' ' << p << endl;
  m -= n - 1;
  for (int i = 1; i < n - 1; ++i) {
    for (int j = i + 2; j <= n && m; ++j) {
      cout << i << ' ' << j << ' ' << (int)1e9 << endl;
      --m;
    }
  }
}
