#include <bits/stdc++.h>
using namespace std;
bool prime[1000003];
vector<pair<long long, long long> > g[1000003];
int n, m;
int main() {
  cin >> n >> m;
  memset(prime, true, sizeof prime);
  prime[1] = false;
  for (int i = 2; i <= 300003; i++) {
    if (prime[i]) {
      for (int j = i * 2; j <= 300003; j += i) {
        prime[j] = false;
      }
    }
  }
  for (int i = 1; i < n - 1; i++) {
    g[i].push_back(make_pair(i + 1, 1));
  }
  int now = 1;
  for (now = 1; 1; now++) {
    if (prime[now + n - 2]) {
      g[n - 1].push_back(make_pair(n, now));
      break;
    }
  }
  int satu = 1, dua = 3, cnt = n - 1;
  while (cnt < m) {
    g[satu].push_back(make_pair(dua, 1e9));
    if (dua == n) {
      satu++;
      dua = satu + 2;
    } else {
      dua++;
    }
    cnt++;
  }
  cout << now + n - 2 << ' ' << now + n - 2 << endl;
  for (int i = 1; i <= n; i++) {
    for (auto j : g[i]) {
      cout << i << ' ' << j.first << ' ' << j.second << endl;
    }
  }
}
