#include <bits/stdc++.h>
using namespace std;
int n, m;
const int P = 3e5 + 7;
const int Max_m = 1e5 + 10;
const int MAX = 4e5;
struct Edge {
  int u;
  int v;
  int w;
};
Edge edge[Max_m];
bool isPrime(long long x) {
  for (long long i = 2; i * i <= x; ++i) {
    if (x % i == 0) {
      return false;
    }
  }
  return true;
}
void solve() {
  scanf("%d%d", &n, &m);
  int cnt = 1;
  printf("2 ");
  if (n > 2) {
    printf("300007\n");
  } else {
    printf("2\n");
  }
  edge[1] = Edge{1, n, 2};
  for (int i = 1; i < n - 2; ++i) {
    edge[i + 1] = Edge{i, i + 1, 3};
  }
  if (n > 2) {
    edge[n - 1] = Edge{n - 2, n - 1, P - (2 + 3 * (n - 3))};
  }
  for (int i = 1; i < n; ++i) {
    printf("%d %d %d\n", edge[i].u, edge[i].v, edge[i].w);
  }
  if (m > n - 1) {
    int num = 0, sume = m - n + 1;
    for (int i = 1; i < n; ++i) {
      for (int j = i + 1; j <= n; ++j) {
        if (i == 1 && j == n) {
          continue;
        }
        if (abs(i - j) > 1 || (i == n - 1 && j == n)) {
          printf("%d %d %d\n", i, j, MAX);
          num++;
        }
        if (num >= sume) {
          return;
        }
      }
    }
  }
}
int main(void) {
  solve();
  return 0;
}
