#include <bits/stdc++.h>
using namespace std;
long long nextprime(long long n) {
  long long i, j, f;
  for (i = 0; i <= 200; ++i) {
    f = 0;
    if ((n + i) % 2 == 0 && n != 2) {
      continue;
    }
    for (j = 3; (j * j) <= (n + i); j += 2) {
      if ((n + i) % j == 0) {
        f = 1;
        break;
      }
    }
    if (f == 0) return (n + i);
  }
}
signed main() {
  long long n, m;
  cin >> n >> m;
  if (n == 2) {
    cout << "2 2\n1 2 2";
    return 0;
  }
  long long i, j;
  long long sum = nextprime(n - 1);
  cout << "2 " << sum << "\n";
  cout << "1 2 1\n2 " << n << " 1\n";
  m -= 2;
  if (m == 0) return 0;
  if (n == 3) {
    cout << "1 3 2";
    return 0;
  }
  cout << n << " " << n - 1 << " " << sum - (n - 2) << "\n";
  --m;
  j = 1;
  while (m > 0 && j < n - 1) {
    i = max(j + 1, (long long)3);
    while (m > 0 && i < n - 1) {
      cout << j << " " << i << " 1\n";
      ++i;
      --m;
    }
    if (m == 0) return 0;
    ++j;
  }
  i = 1;
  while (m > 0 && i < n - 1) {
    cout << i << " " << n - 1 << " " << sum - (n - 2) << "\n";
    ++i;
    --m;
  }
  i = 3;
  while (m > 0 && i < n - 1) {
    cout << i << " " << n << " 1\n";
    ++i;
    --m;
  }
  if (m == 1) {
    cout << "1 " << n << " 2\n";
    --m;
  }
  if (m > 0) {
    cout << "Doob jaa";
  }
  return 0;
}
