#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.precision(20);
  const int MAX_N = (int)1e7;
  vector<bool> isPrime(MAX_N, true);
  isPrime[1] = false;
  for (int i = 2; i < MAX_N; i++) {
    if (isPrime[i]) {
      for (int j = 2 * i; j < MAX_N; j += i) {
        isPrime[j] = false;
      }
    }
  }
  int n, m;
  cin >> n >> m;
  long long sum = 0;
  vector<set<int>> has(n + 10);
  vector<int> u, v, w;
  auto push = [&](int a, int b, int c) {
    u.push_back(a);
    v.push_back(b);
    w.push_back(c);
    has[a].insert(b);
    has[b].insert(a);
    m--;
    sum += c;
  };
  push(1, n, 2);
  for (int i = 1; i + 1 < n; i++) {
    if (i + 1 == n - 1) {
      int w = 2;
      while (!isPrime[sum + w]) {
        w++;
      }
      push(i, i + 1, w);
      break;
    }
    push(i, i + 1, 2);
  }
  assert(isPrime[sum]);
  cout << 2 << " " << sum << "\n";
  for (int i = 1; i <= n && m > 0; i++) {
    for (int j = i + 1; j <= n && m > 0; j++) {
      if (has[i].count(j)) {
        continue;
      }
      const int MAX_VALUE = (int)1e8;
      push(i, j, MAX_VALUE);
    }
  }
  for (int i = 0; i < ((int)(u).size()); i++) {
    cout << u[i] << " " << v[i] << " " << w[i] << "\n";
  }
}
