#include <bits/stdc++.h>
using namespace std;
const int MAX = 1000000;
void sieve(vector<int> &list_primes) {
  vector<bool> primes(MAX, true);
  for (int i = 2; i * i < MAX; i++) {
    if (primes[i]) {
      for (int j = i * 2; j < MAX; j += i) primes[j] = false;
    }
  }
  for (int i = 2; i < MAX; i++) {
    if (primes[i]) list_primes.push_back(i);
  }
}
int main() {
  vector<int> list_primes;
  sieve(list_primes);
  int n, m;
  cin >> n >> m;
  int last_weight =
      *lower_bound(list_primes.begin(), list_primes.end(), n - 1) - (n - 2);
  int sp = n - 2 + last_weight, mstw = n - 2 + last_weight;
  cout << sp << ' ' << mstw << endl;
  for (int i = 1; i <= (n - 2); i++)
    cout << i << ' ' << i + 1 << ' ' << 1 << endl;
  cout << n - 1 << ' ' << n << ' ' << last_weight << endl;
  m -= (n - 1);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (j == i + 1) continue;
      if (m == 0) goto out;
      cout << i << ' ' << j << ' ' << sp + 1 << endl;
      m--;
    }
  }
out:
  return 0;
}
