#include"bits/stdc++.h"
using namespace std;
#define int long long
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int> P;
constexpr long long inf = 1e17;
constexpr int mod = 998244353;

signed main() {
	int n, k; cin >> n >> k;
	vector<int>v1(n), v2(n), v3(n);
	for (int i = 0; i < n; i += 2) {
		v1[i] = k; k++;
	}
	for (int i = 1; i < n; i += 2) {
		v1[i] = k; k++;
	}
	for (int i = 1; i < n; i += 2) {
		v2[i] = k; k++;
	}
	for (int i = 0; i < n; i += 2) {
		v2[i] = k; k++;
	}
	rep(i, n) {
		v3[i] = k; k++;
	}
	int flg = 0;
	rep(i, n) {
		if (v1[i] + v2[i] > v3[i])flg++;
	}
	if (flg)cout << -1 << endl;
	else {
		rep(i, n) {
			cout << v1[i] << ' ' << v2[i] << ' ' << v3[i] << endl;
		}
	}
}