#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
ll N, K;

int main() {
  cin >> N >> K;
  if(N < K*2 - 1) {
    cout << -1;
    return 0;
  }
  vector<ll> a, b;
  if(N & 1) {
    for(int i = K; i < K + N; i += 2) a.push_back(i);
    for(int i = N/2; i >= 0; --i) b.push_back(i + K + N);
    for(int i = K+1; i < K + N; i += 2) a.push_back(i);
    for(int i = N-1; i > N / 2; --i) b.push_back(i + K + N);
  } else {
    for(int i = K+1; i < K + N; i += 2) a.push_back(i);
    for(int i = N/2-1; i >= 0; --i) b.push_back(i + K + N);
    for(int i = K; i < K + N; i += 2) a.push_back(i);
    for(int i = N-1; i >= N / 2; --i) b.push_back(i + K + N);
  }
  for(int i = 0; i < N; ++i) cout << a[i] << " " << b[i] << " " << i + K + N * 2 << '\n';
  return 0;
}