#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;
vector<int> sieve(int n) {
  vector<bool> f(n + 1);
  for (int i = 3; i <= n; i += 2) f[i] = 1;
  for (int i = 3; i <= sqrt(n); i += 2)
    if (f[i])
      for (int j = i * 3; j <= n; j += i) f[j] = 0;
  vector<int> res;
  if (n >= 2) res.push_back(2);
  for (int i = 3; i <= n; i += 2)
    if (f[i]) res.push_back(i);
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  const int R = (int)2e5;
  const int MAX = (int)1e9;
  int n, m;
  cin >> n >> m;
  if (n == 2) {
    cout << 2 << ' ' << 2 << endl;
    cout << 1 << ' ' << 2 << ' ' << 2 << endl;
    return 0;
  }
  vector<tuple<int, int, int> > ans;
  ans.emplace_back(1, n, 2);
  auto ps = sieve(R);
  int cur = 2;
  for (int i = 2; i < n - 1; ++i) {
    cur++;
    ans.emplace_back(1, i, 1);
  }
  int prime = *lower_bound((ps).begin(), (ps).end(), cur + 1);
  ans.emplace_back(1, n - 1, prime - cur);
  int rem = m - (n - 1);
  [&] {
    for (int i = 2; i <= n; ++i)
      for (int j = i + 1; j <= n; ++j) {
        if (rem == 0) return;
        rem--;
        ans.emplace_back(i, j, MAX);
      }
  }();
  cout << 2 << ' ' << prime << endl;
  assert((int)(ans).size() == m);
  for (int(i) = (0); (i) < (int)(m); ++(i)) {
    int u, v, w;
    tie(u, v, w) = ans[i];
    cout << u << ' ' << v << ' ' << w << endl;
  }
}
