#include <bits/stdc++.h>
using namespace std;
vector<tuple<long long int, long long int, long long int>> edges;
bool isPrime(long long int a) {
  for (int i = 2; i * i <= a; i++) {
    if (a % i == 0) return false;
  }
  return true;
}
long long int nextPrime(long long int mst) {
  for (long long int i = mst; i < 1000000000; i++) {
    if (isPrime(i)) {
      return i;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  long long int n, m;
  cin >> n >> m;
  long long int mst = n, st = 2;
  for (long long int i = 2; i < n; i++) {
    edges.push_back({1, i, 1});
  }
  edges.push_back({1, n, 2});
  long long int next_prime = nextPrime(mst) - mst;
  mst += next_prime;
  get<2>(edges[0]) += next_prime;
  long long int gap = 1;
  while (edges.size() < m) {
    for (long long int i = 2; i <= n - gap; i++) {
      edges.push_back({i, i + gap, mst + 1});
      if (edges.size() == m) break;
    }
    gap++;
  }
  cout << st << " " << mst << endl;
  for (long long int i = 0; i < edges.size(); i++) {
    cout << get<0>(edges[i]) << " " << get<1>(edges[i]) << " "
         << get<2>(edges[i]) << endl;
  }
  return 0;
}
