#include <bits/stdc++.h>
using namespace std;
bool prime(int x) {
  for (int i = 2; i * i <= x; i++)
    if (x % i == 0) return false;
  return true;
}
int main() {
  int n, m, cnt = 2, sum = 2;
  scanf("%d %d", &n, &m);
  m -= n - 1;
  vector<vector<pair<int, int> > > g(n);
  g[0].push_back(pair<int, int>(n - 1, 2));
  for (int i = 0; i < n - 3; i++) {
    g[i].push_back(pair<int, int>(i + 1, 3));
    g[i + 1].push_back(pair<int, int>(i, 3));
    sum += 3;
  }
  if (n > 2) {
    cnt = sum + 2;
    while (!prime(cnt)) cnt++;
    g[n - 3].push_back(pair<int, int>(n - 2, cnt - sum));
    g[n - 2].push_back(pair<int, int>(n - 3, cnt - sum));
  }
  while (m) {
    for (int i = 0; i < n && m != 0; i++) {
      vector<int> k(n, 0);
      for (int j = 0; j < (int)g[i].size(); j++) k[g[i][j].first] = 1;
      for (int j = 0; j < n && m != 0; j++)
        if (i != j && k[j] == 0) {
          g[i].push_back(pair<int, int>(j, 1e9));
          g[j].push_back(pair<int, int>(i, 1e9));
          m--;
        }
    }
  }
  printf("%d %d\n", 2, cnt);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < (int)g[i].size(); j++)
      if (g[i][j].first > i)
        printf("%d %d %d\n", i + 1, g[i][j].first + 1, g[i][j].second);
  return 0;
}
