#include <bits/stdc++.h>
using namespace std;
int n, m;
set<pair<int, int> > s;
bitset<100010> bs;
vector<int> prime;
void sieve() {
  bs.set();
  for (int i = 2; i <= 1000; ++i) {
    if (bs[i] != 0) {
      for (int j = i * i; j <= 100010; j += i) {
        bs[j] = 0;
      }
    }
  }
  for (int i = 2; i <= 100007; ++i) {
    if (bs[i] != 0) prime.push_back(i);
  }
}
int main() {
  sieve();
  scanf("%d%d", &n, &m);
  int foo = *upper_bound(prime.begin(), prime.end(), (n - 1));
  printf("2 %d\n1 %d 2\n", foo, n);
  foo -= 2;
  for (int i = n - 1; i >= 2; --i) {
    printf("%d %d ", 1, i);
    if (i == 2)
      printf("%d\n", foo);
    else
      printf("1\n"), foo--;
    s.insert(pair<int, int>(1, i));
  }
  int cnt = n - 1;
  for (int i = 2; i <= n && cnt < m; ++i) {
    for (int j = 1; j <= n && cnt < m; ++j) {
      if (i != j && (s.count(pair<int, int>(min(i, j), max(i, j))) == 0)) {
        printf("%d %d 1000000000\n", min(i, j), max(i, j));
        s.insert(pair<int, int>(min(i, j), max(i, j)));
        cnt++;
      }
    }
  }
  return 0;
}
