#include <bits/stdc++.h>
using namespace std;
int n, m, sum;
int main() {
  scanf("%d%d", &n, &m);
  if (n == 2) {
    printf("2 2\n");
    printf("1 2 2\n");
    return 0;
  } else {
    printf("2 998244353\n");
    printf("1 %d 2\n", n);
    for (int i = 2; i <= n - 2; i++) {
      printf("%d %d 1\n", i, n);
    }
    sum = 998244353 - (2 + n - 3);
    printf("%d %d %d\n", n, n - 1, sum);
    int cnt = 0;
    if (m > n - 1) {
      int temp = m - (n - 1);
      for (int i = 1; i <= n - 1; i++) {
        for (int j = i + 1; j <= n - 1; j++) {
          printf("%d %d %d\n", i, j, 1000000000);
          cnt++;
          if (cnt == temp) return 0;
        }
      }
    }
  }
}
