#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const long long int inf64 = 1e18 + 5;
const int MAX = 2e5 + 5;
vector<int> v;
bool prime[MAX];
int dist[MAX];
void sieve() {
  memset(prime, true, sizeof(prime));
  for (int i = 2; i < MAX; i++) {
    if (prime[i]) {
      for (int j = 2 * i; j < MAX; j += i) prime[j] = false;
    }
  }
  for (int i = 2; i < MAX; i++) {
    if (prime[i]) v.push_back(i);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  sieve();
  int n, m, i, j;
  cin >> n >> m;
  for (i = 2; i <= n; i++) dist[i] = 1;
  dist[n] = 2;
  int sum = accumulate(dist + 1, dist + n + 1, 0) - dist[2];
  m -= (n - 1);
  vector<tuple<int, int, int> > ans;
  int x = upper_bound(v.begin(), v.end(), sum) - v.begin();
  dist[2] = v[x] - sum;
  for (i = 2; i <= n; i++) ans.push_back(make_tuple(1, i, dist[i]));
  bool poss = true;
  for (i = 2; i <= n; i++) {
    for (j = i + 1; j <= n; j++) {
      m--;
      if (m < 0) {
        poss = false;
        break;
      }
      ans.push_back(make_tuple(i, j, inf));
    }
    if (!poss) break;
  }
  sum = accumulate(dist + 1, dist + n + 1, 0);
  cout << dist[n] << ' ' << sum << '\n';
  for (auto x : ans)
    cout << get<0>(x) << ' ' << get<1>(x) << ' ' << get<2>(x) << '\n';
}
