#include <bits/stdc++.h>
using namespace std;
bool is(int x) {
  for (int j = 2; j <= x - 1; j++) {
    if (x % j == 0) return false;
  }
  return true;
}
int p(int x) {
  x++;
  for (int i = x;; i++) {
    if (is(i)) return i;
  }
}
int main(void) {
  int n, m;
  cin >> n >> m;
  m -= n - 1;
  int mmin = p(n);
  cout << mmin << " " << mmin << endl;
  for (int i = 1; i <= n - 2; i++) printf("%d %d %d\n", i, i + 1, 1);
  printf("%d %d %d\n", n - 1, n, mmin - (n - 2));
  if (m == 0) return 0;
  for (int i = 1; i <= n - 1; i++) {
    for (int j = i + 2; j <= n; j++) {
      printf("%d %d %d\n", i, j, mmin + 10086);
      m--;
      if (m == 0) return 0;
    }
  }
}
