#include <bits/stdc++.h>
using namespace std;
bool check(long long int n) {
  if (n == 1) return 0;
  bool q = 0;
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      q = 1;
      break;
    }
  }
  return !q;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  long long int A = n - 1;
  while (!check(A)) {
    A++;
  }
  cout << A << " " << A << endl;
  for (int i = 1; i <= A - n + 1; i++) {
    cout << i << " " << i + 1 << " " << 2 << endl;
  }
  for (int i = A - n + 2; i <= n - 1; i++) {
    cout << i << " " << i + 1 << " " << 1 << endl;
  }
  m -= (n - 1);
  for (int i = 1; i <= n; i++) {
    for (int j = i + 2; j <= n; j++) {
      if (m == 0) return 0;
      m--;
      cout << i << " " << j << " " << 10000000 << endl;
    }
  }
  return 0;
}
