#include <bits/stdc++.h>
using namespace std;
int prime(int n) {
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) return 0;
  }
  return 1;
}
int main() {
  int n, m;
  cin >> n >> m;
  if (m == 1) {
    cout << 2 << " " << 2 << "\n";
    cout << 1 << " " << 2 << " " << 2 << "\n";
    return 0;
  }
  int d = n - 2;
  d++;
  while (prime(d) != 1) {
    d++;
  }
  cout << d << " " << d << "\n";
  for (int i = 1; i <= n - 2; ++i) {
    cout << i << " " << i + 1 << " " << 1 << "\n";
    m--;
    if (m <= 0) break;
  }
  int last = d - (n - 2);
  if (m > 0) {
    cout << n - 1 << " " << n << " " << last << "\n";
    m--;
  }
  for (int i = 1; i <= n; ++i) {
    if (m <= 0) break;
    for (int j = i + 2; j <= n - 1; ++j) {
      cout << i << " " << j << " " << j - i << "\n";
      m--;
      if (m <= 0) break;
    }
    if (m <= 0) break;
    if (i < n - 1) {
      cout << i << " " << n << " " << n - 1 - i + last << "\n";
      m--;
      if (m <= 0) break;
    }
  }
}
