#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int N, K;
  cin >> N >> K;
  vector<ll> a(N), b(N), c(N);
  if (2 * K > (N + 1)) {
    cout << -1 << endl;
    return 0;
  }
  if (N % 2 == 1) {
    int M = (N + 1) / 2;
    for (int k = 0; k < M; k++) {
      a[k] = K + M - 1 - k;
      b[k] = K - 1 + 2 * k;
      c[k] = K + 5 * M - 2 + k;
    }
    for (int k = 0; k < M - 1; k++) {
      a[k + M] = 3 * M - 2 - k;
      b[k + M] = 3 * M + 2 * k;
      c[k + M] = 6 * M - 2 + k;
    }
    for (int i = 0; i < N; i++) {
      a[i] += K - M;
      b[i] += K - M;
      c[i] += K - M;
    }
  } else {
    int M = N / 2;
    for (int k = 0; k < M; k++) {
      a[k] = 2 * M - 1 - k;
      b[k] = 3 * M + 2 * k;
      c[k] = 5 * M + k;
    }
    for (int k = 0; k < M; k++) {
      a[k + M] = 3 * M - 1 - k;
      b[k + M] = 3 * M + 1 + 2 * k;
      c[k + M] = 6 * M + k;
    }
    for (int i = 0; i < N; i++) {
      a[i] += K - M;
      b[i] += K - M;
      c[i] += K - M;
    }
  }
  for (int i = 0; i < N; i++) {
    cout << a[i] << " " << b[i] << " " << c[i] << endl;
  }
  return 0;
}
