#include <bits/stdc++.h>
long long inf = 1LL << 60;
long long mod = 1000000007;
double pi = acos(-1.0);
using namespace std;
int r = 1;
bool notprime(int n) {
  if (n % 2 == 0) return true;
  for (int i = 3; i * i <= n; i += 2) {
    if (n % i == 0) return true;
  }
  return false;
}
int calc(int n) {
  if (n == 2) return 2;
  int mstw = 2 + n - 3;
  while (notprime(mstw + r)) r++;
  return mstw + r;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  set<pair<int, int> > edges;
  cin >> n >> m;
  int mstw = calc(n);
  int spw = 2;
  cout << spw << " " << mstw << endl;
  cout << 1 << " " << n << " " << 2 << endl;
  edges.insert({1, n});
  if (n > 2) {
    cout << 1 << " " << 2 << " " << r << endl;
    edges.insert({1, 2});
    for (int i = 2; i != n - 1; i++) {
      cout << i << " " << i + 1 << " " << 1 << endl;
      edges.insert({i, i + 1});
    }
    m -= (n - 1);
    if (m) {
      for (int i = 1; i <= n && m; i++) {
        for (int j = i + 1; j <= n && m; j++) {
          if (edges.find({i, j}) == edges.end())
            cout << i << " " << j << " " << 1000000000 << endl, m--;
        }
      }
    }
  }
  return 0;
}
