#include <bits/stdc++.h>
using namespace std;
const int N = 100002, P = 27644437;
int n, m;
struct str {
  int x, y, z;
};
vector<str> edges;
int main() {
  scanf("%d%d", &n, &m);
  --m;
  edges.push_back({1, n, 2});
  for (int i = 2; i <= n - 2; ++i) {
    --m;
    edges.push_back({1, i, 1});
  }
  if (n > 2) {
    --m;
    edges.push_back({1, n - 1, P - 2 - (n - 3)});
  }
  if (m) {
    for (int i = 2; i <= n; ++i)
      for (int j = i + 1; j <= n; ++j) {
        edges.push_back({i, j, P});
        if (--m == 0) goto done;
      }
  }
done:
  printf("2 %d\n", n == 2 ? 2 : P);
  for (str second : edges) printf("%d %d %d\n", second.x, second.y, second.z);
}
