#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > adj[100005];
long long int sp = 0, mst = 0, p = 100003;
int n, m;
int main() {
  cin >> n >> m;
  long long int c = p - (n - 2);
  adj[1].push_back({2, c});
  m--;
  for (int i = 2; i <= n - 2 + 1; i++, m--) adj[i].push_back({i + 1, 1});
  if (m != 0) {
    for (int i = 1; i < n && m != 0; i++) {
      for (int j = i + 2; j <= n; j++) {
        adj[i].push_back({j, 1e7});
        m--;
        if (m == 0) break;
      }
    }
  }
  cout << p << ' ' << p << endl;
  for (int i = 1; i < n; i++) {
    for (int j = 0; j < adj[i].size(); j++)
      cout << i << ' ' << adj[i][j].first << ' ' << adj[i][j].second << endl;
  }
  return 0;
}
