#include <bits/stdc++.h>
using namespace std;
int n, m;
bool Isprime(int x) {
  if (x == 1) return 0;
  if (x == 2) return 1;
  for (int i = 2; i * i <= x; ++i) {
    if (x % i == 0) return 0;
  }
  return 1;
}
int main() {
  scanf("%d%d", &n, &m);
  int ans;
  for (int i = n - 1;; ++i) {
    if (Isprime(i)) {
      ans = i;
      break;
    }
  }
  printf("%d %d\n", ans, ans);
  for (int i = 1; i < n - 1; ++i) printf("%d %d %d\n", i, i + 1, 1);
  printf("%d %d %d\n", n - 1, n, ans - (n - 2));
  int val = 1e9;
  int cnt = n - 1;
  val -= 1;
  if (cnt < m) {
    for (int i = 1; i <= n; ++i) {
      for (int j = i + 2; j <= n; ++j) {
        ++cnt;
        printf("%d %d %d\n", i, j, val);
        if (cnt == m) break;
      }
      if (cnt == m) break;
    }
  }
  return 0;
}
