#include <bits/stdc++.h>
using namespace std;
inline void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
inline void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
inline void Yay(bool b) { cout << (b ? "Yay!" : ":(") << endl; }
struct tri {
  long long f, s, t;
};
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(15);
  int N;
  long long K;
  cin >> N >> K;
  vector<pair<int, int> > v(N);
  vector<int> w(N);
  long long b;
  b = K + 2 * N - 1;
  int index = 0;
  if (2 * K - 1 > N) {
    cout << -1 << endl;
    return 0;
  }
  for (int x = (K), x_max = (K + N); x < x_max; ++x) {
    if ((x & 1) == 0) continue;
    v[index].first = x + b;
    v[index].second = x;
    w[index] = x;
    ++index;
    --b;
  }
  for (int x = (K), x_max = (K + N); x < x_max; ++x) {
    if (x & 1) continue;
    v[index].first = x + b;
    v[index].second = x;
    w[index] = x;
    ++index;
    --b;
  }
  long long c = K + 2 * N;
  queue<tri> que;
  for (int i = 0, i_max = (N); i < i_max; ++i) {
    que.push({v[i].second, v[i].first - v[i].second, c});
    ++c;
  }
  while (!que.empty()) {
    tri t = que.front();
    que.pop();
    cout << t.f << " " << t.s << " " << t.t << endl;
  }
  return 0;
}
