#include <bits/stdc++.h>
using namespace std;
vector<int> prime;
void seive() {
  int n = 1000000;
  unordered_map<int, bool> visited;
  for (int i = 2; i < n; i++) {
    if (visited[i] == false) {
      prime.push_back(i);
      for (int j = 1; (j * i) < n; j++) visited[i * j] = true;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  seive();
  int n, m;
  cin >> n >> m;
  int flag = 0;
  cout << 2 << " ";
  int x = lower_bound(prime.begin(), prime.end(), n) - prime.begin();
  if (prime[x] == n) {
    cout << n << endl;
    flag = 1;
  } else {
    cout << prime[x] << endl;
  }
  cout << 1 << " " << n << " " << 2 << endl;
  for (int i = 2; i < n - 1; i++) {
    cout << 1 << " " << i << " " << 1 << endl;
  }
  if (flag && n > 2)
    cout << 1 << " " << n - 1 << " " << 1 << endl;
  else if (n > 2)
    cout << 1 << " " << n - 1 << " " << prime[x] - n + 1 << endl;
  int k = n - 1;
  for (int i = 2; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (k >= m) return 0;
      cout << i << " " << j << " " << 10000000 << endl;
      k++;
    }
  }
  return 0;
}
