#include <bits/stdc++.h>
using namespace std;
int sieve(int n) {
  bool b[200005];
  memset(b, 0, sizeof b);
  b[1] = 1;
  for (int i = 2; i <= 200000 / i; i++)
    if (!b[i])
      for (int j = i * i; j <= 200000; j += i) b[j] = 1;
  for (int i = n - 1;; i++)
    if (b[i] == 0) return i;
}
int main() {
  ios::sync_with_stdio(false);
  int i, j, n, m;
  cin >> n >> m;
  int p = sieve(n);
  cout << p << ' ' << p << endl;
  p = p - n + 1;
  for (i = 1; i < n; i++) {
    if (p) {
      p--;
      cout << i << ' ' << (i + 1) << ' ' << 2 << endl;
    } else
      cout << i << ' ' << (i + 1) << ' ' << 1 << endl;
  }
  m = m - n + 1;
  for (i = 1; i < n && m; i++)
    for (j = i + 2; j <= n && m; j++) {
      cout << i << ' ' << j << ' ' << 2 * (j - i + 1) << endl;
      m--;
    }
  return 0;
}
