#include <bits/stdc++.h>
using namespace std;
const int N = 1e7 + 7;
vector<int> primes;
bitset<N> isprime;
int n, m;
void sieve() {
  isprime.set();
  isprime[0] = isprime[1] = 0;
  isprime[2] = 1;
  primes.push_back(2);
  for (int i = 3; i < N; i += 2)
    if (isprime[i]) {
      for (int j = i * 2; j < N; j += i) isprime[j] = 0;
      primes.push_back(i);
    }
}
bool is_prime(long long x) {
  if (x % 2 == 0) return (x == 2) ? 1 : 0;
  if (x < N) return isprime[x];
  for (int i = 0; i < primes.size(); i++)
    if (x % primes[i] == 0) return false;
  return true;
}
int main() {
  ios::sync_with_stdio(false);
  sieve();
  cin >> n >> m;
  auto it = lower_bound(primes.begin(), primes.end(), n);
  int x = *it - n;
  cout << 2 << " " << x + n << endl;
  for (int j = 0, i = 2; j < n - 1; j++, i++) {
    if (i == n)
      cout << 1 << " " << i << " " << 2 << endl;
    else if (i != n - 1)
      cout << 1 << " " << i << " " << 1 << endl;
    else
      cout << 1 << " " << i << " " << x + 1 << endl;
  }
  m -= (n - 1);
  for (int i = 2; i <= n && m; i++) {
    for (int j = i + 1; j <= n && m; j++) {
      cout << i << " " << j << " " << 1000 << endl;
      m--;
    }
  }
  return 0;
}
