#include <bits/stdc++.h>
using namespace std;
bool isPrime(int n) {
  if (n == 1) return false;
  for (int i = 2; i < min(floor(sqrt((double)n) + 1), (double)n); i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int getPrime(int n) {
  int start = n - 1;
  if ((n - 1) % 2 == 0) start = n;
  while (!isPrime(start)) {
    start += 2;
  }
  return start;
}
int main() {
  std::ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  int prime = getPrime(n);
  cout << prime << " " << prime << endl;
  for (int i = 2; i < n; i++) {
    cout << i - 1 << " " << i << " " << 1 << endl;
  }
  cout << n - 1 << " " << n << " " << prime - (n - 2) << endl;
  int rem = m - (n - 1);
  if (rem == 0) return 0;
  for (int i = 1; i <= n - 2; i++) {
    for (int j = i + 2; j <= n; j++) {
      if (rem == 0) break;
      cout << i << " " << j << " " << 1000000000 << endl;
      rem--;
    }
    if (rem == 0) break;
  }
}
