#include <bits/stdc++.h>
using namespace std;
bool ok[200005];
vector<int> primes;
void erastos() {
  fill(ok + 2, ok + 200005, true);
  for (int i = 2; i * i <= 200000; i++) {
    if (ok[i]) {
      for (int j = i * 2; j <= 200000; j += i) ok[j] = false;
    }
  }
  for (int i = 2; i <= 200000; i++) {
    if (ok[i]) primes.push_back(i);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  erastos();
  int n, m;
  cin >> n >> m;
  if (n == 2) {
    cout << "2 2\n1 2 2\n";
    return 0;
  }
  int cnt = n - 1, wcnt = 2 + (n - 3);
  int special = *lower_bound(primes.begin(), primes.end(), wcnt + 1) - wcnt;
  cout << "2 " << special + wcnt << '\n';
  cout << "1 " << n << " 2\n";
  for (int i = 2; i < n - 1; i++) {
    cout << "1 " << i << " 1\n";
  }
  cout << "1 " << n - 1 << ' ' << special << '\n';
  for (int i = 2; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (cnt >= m) break;
      cout << i << ' ' << j << ' ' << 10000000 << '\n';
      cnt++;
    }
  }
  return 0;
}
