#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 2e5 + 7;
const long long P = 1000003;
const long long MOD = 1000 * 1000 * 1000;
struct Edge {
  long long u, v, c;
};
Edge init(long long u, long long v, long long c) {
  Edge res;
  res.u = u;
  res.v = v;
  res.c = c;
  return res;
}
vector<Edge> ans;
signed main() {
  ios_base::sync_with_stdio(false);
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < n - 2; ++i) {
    ans.push_back(init(i, i + 1, 1));
  }
  ans.push_back(init(n - 2, n - 1, P - (n - 2)));
  long long ost = m - (n - 1);
  for (long long i = 0; i < n; ++i) {
    if (ost == 0) break;
    for (long long j = i + 2; j < n; ++j) {
      if (ost == 0) break;
      ans.push_back(init(i, j, MOD));
      --ost;
      if (ost == 0) break;
    }
    if (ost == 0) break;
  }
  cout << P << ' ' << P << '\n';
  for (Edge e : ans) {
    cout << e.u + 1 << ' ' << e.v + 1 << ' ' << e.c << '\n';
  }
  return 0;
}
