#include <bits/stdc++.h>
using namespace std;
int const mod = 1e9 + 7;
int n, i, j, k, t, p = 2, m;
map<pair<int, int>, int> s;
bool cekprime(int a) {
  if (a < 2 || a == 4 || a == 8 || a == 6) return false;
  for (i = 3; i <= sqrt(a); i += 2) {
    if (a % i == 0) return false;
  }
  return true;
}
int main() {
  scanf("%d %d", &n, &m);
  s[{1, n}] = 2;
  for (i = 2; i < n - 1; i++) {
    s[{i - 1, i}] = 2;
    p += 2;
  }
  if (n > 2) {
    p += 3;
    s[{n - 2, n - 1}] = 3;
    while (!cekprime(p)) {
      p += 2;
      s[{n - 2, n - 1}] += 2;
    }
  }
  m -= n - 1;
  for (i = 1; i <= n && m > 0; i++) {
    for (j = i + 1; j <= n && m > 0; j++) {
      if (s.find({i, j}) == s.end()) {
        s[{i, j}] = 1e9;
        m--;
      }
    }
  }
  printf("%d %d\n", 2, p);
  for (auto x : s) {
    printf("%d %d %d\n", x.first.first, x.first.second, x.second);
  }
  return 0;
}
