#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
const long long INF = 1ll * 0x3f3f3f3f;
int d = 0, sang[N], n, m;
vector<pair<int, int> > a[N];
void INIT() {
  memset(sang, true, sizeof sang);
  sang[0] = sang[1] = false;
  for (int i = (2); i <= (sqrt(N)); ++i)
    for (int j = i; j <= N / i; j++) sang[j * i] = false;
  for (int i = (2); i <= (N); ++i)
    if (sang[i]) sang[++d] = i;
}
int main() {
  INIT();
  cin >> n >> m;
  int sum = n - 2, ans = *upper_bound(sang + 1, sang + 1 + d, sum);
  cout << ans << " " << ans << endl;
  for (int i = (1); i <= (n - 2); ++i)
    cout << i << " " << i + 1 << " " << 1 << endl;
  cout << n - 1 << " " << n << " " << ans - sum << endl;
  int cnt = 0;
  for (int i = (1); i <= (n - 2); ++i)
    for (int j = (i + 2); j <= (n); ++j)
      if (++cnt <= m - n + 1)
        cout << i << " " << j << " " << N << endl;
      else
        break;
  return 0;
}
