#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int n, m;
bool vis[N];
vector<int> f;
void solve() {
  vis[1] = 1;
  for (int i = 2; i < N; ++i) {
    if (vis[i] == 0) {
      f.push_back(i);
      for (int j = i * 2; j < N; j += i) vis[j] = 1;
    }
  }
}
int main() {
  solve();
  scanf("%d%d", &n, &m);
  int tmp = lower_bound(f.begin(), f.end(), n) - f.begin();
  tmp = f[tmp];
  int k = tmp * 100;
  printf("%d %d\n", tmp, tmp);
  for (int i = 1; i < n; ++i) {
    if (i == 1)
      printf("%d %d %d\n", i, i + 1, tmp - (n - 2));
    else
      printf("%d %d 1\n", i, i + 1);
  }
  m = m - (n - 1);
  for (int i = 1; i <= n; ++i)
    for (int j = i + 2; j <= n; ++j) {
      if (m == 0) return 0;
      printf("%d %d %d\n", i, j, k);
      m--;
    }
  return 0;
}
