#include <bits/stdc++.h>
using namespace std;
const int N = 300010;
const int oo = 1e9;
const int MOD = 1000000007;
int n, m;
vector<int> prime;
bool mark[1000010];
int main() {
  for (int i = 2; i <= 1000000; ++i) {
    if (mark[i]) continue;
    for (int j = i; j <= 1000000; j += i) {
      mark[j] = 1;
    }
    prime.push_back(i);
  }
  scanf("%d%d", &n, &m);
  vector<pair<pair<int, int>, int> > edge;
  long long sum = 2;
  edge.push_back(make_pair(make_pair(1, n), 2));
  for (int i = 2; i < n; ++i) {
    edge.push_back(make_pair(make_pair(1, i), 1));
    sum++;
  }
  long long pr = *lower_bound(prime.begin(), prime.end(), sum);
  long long closet = *lower_bound(prime.begin(), prime.end(), sum) - sum;
  edge.back().second += closet;
  m -= edge.size();
  for (int i = 2; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (m <= 0) break;
      --m;
      edge.push_back(make_pair(make_pair(i, j), oo));
    }
  }
  printf("%d %lld\n", 2, pr);
  for (int i = 0; i < edge.size(); ++i) {
    printf("%d %d %d\n", edge[i].first.first, edge[i].first.second,
           edge[i].second);
  }
  return 0;
}
