#include <bits/stdc++.h>
using namespace std;
int Day12[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int prime100[] = {2,  3,  5,  7,  11, 13, 17, 19, 23, 29, 31, 37,  41, 43,
                  47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103};
template <typename T>
inline bool isLeap(T y) {
  return (y % 400 == 0) || (y % 100 ? y % 4 == 0 : false);
}
template <typename T>
inline T GCD(T a, T b) {
  a = abs(a);
  b = abs(b);
  if (a < b) swap(a, b);
  while (b) {
    a = a % b;
    swap(a, b);
  }
  return a;
}
template <typename T>
inline T LCM(T x, T y) {
  T tp = GCD(x, y);
  if ((x / tp) * 1. * y > 9e18) return 9e18;
  return (x / tp) * y;
}
template <typename T>
inline T BIGMOD(T A, T B, T M = 1000000009) {
  T ret = 1;
  while (B) {
    if (B & 1) ret = (ret * A) % M;
    A = (A * A) % M;
    B = B >> 1;
  }
  return ret;
}
template <typename T>
inline T BigMod(T A, T B, T M) {
  T ret = 1;
  while (B) {
    if (B & 1) ret = (ret * A) % M;
    A = (A * A) % M;
    B = B >> 1;
  }
  return ret;
}
long long int MySqrt(long long int n) {
  long long int p = sqrt(n);
  if ((p + 1) * (p + 1) <= n)
    return p + 1;
  else if (p * p <= n)
    return p;
  else
    return p - 1;
}
long long int MyPow(long long int x, long long int n) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return MyPow(x * x, n / 2);
  else
    return x * MyPow(x * x, ((n - 1) / 2));
}
int prime[1000005];
vector<pair<pair<int, int>, long long int> > V;
void Fun() {
  prime[0] = prime[1] = 1;
  for (int i = 2; i <= 1000000; i++)
    for (int j = i + i; j <= 1000000; j += i) prime[j] = 1;
}
void print(long long int sum) {
  int sz = V.size();
  printf("2 %lld\n", sum);
  for (int i = 0; i < sz; i++)
    printf("%d %d %lld\n", V[i].first.first, V[i].first.second, V[i].second);
}
int main() {
  Fun();
  int n, m;
  scanf("%d%d", &(n), &(m));
  long long int sum = 2;
  for (int i = 2; i < n - 1; i++) {
    V.push_back(make_pair(make_pair(1, i), 1));
    sum++;
  }
  V.push_back(make_pair(make_pair(1, n), 2));
  if (n >= 3) {
    long long int rest = 0;
    for (int i = sum + 1;; i++) {
      if (prime[i] == 0) {
        rest = (i - sum);
        break;
      }
    }
    V.push_back(make_pair(make_pair(1, n - 1), rest));
    sum += rest;
  }
  int edge = m - (n - 1);
  for (int i = 2; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (edge > 0) {
        V.push_back(make_pair(make_pair(i, j), 1000000000));
        edge--;
      } else
        break;
    }
  }
  print(sum);
}
