#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
const ll MOD = 998244353;
const ll INF = 10000000000000000;

#define fr first
#define sc second
#define mp1(a,b,c) P1(a,P(b,c))

int main(){
	ll n,k;
	cin >> n >> k;
	
	if(2*k > n+1){
		puts("-1");
		return 0;
	}
	vector<P1> vec;
	if(n%2 == 1){
		for(int i = 0 ; i <= (n-1)/2 ; i ++){
			vec.push_back(mp1(k+2*i,k+2*n-(n-1)/2-i-1,k+2*n+i));
		}
		for(int i = 1 ; i <= (n-1)/2 ; i ++){
			vec.push_back(mp1(k+2*i-1,k+2*n-i,k+2*n+(n-1)/2+i));
		}
	}
	else {
		n --;
		for(int i = 0 ; i <= (n-1)/2 ; i ++){
			vec.push_back(mp1(k+2*i,k+2*n-(n-1)/2-i-1+2,k+2*n+i+2));
		}
		for(int i = 1 ; i <= (n-1)/2 ; i ++){
			vec.push_back(mp1(k+2*i-1,k+2*n-i+2,k+2*n+(n-1)/2+i+2));
		}
		vec.push_back(mp1(k+n,k+n+1,k+3*n+2));
	}
	
	for(int i = 0 ; i < vec.size() ; i ++){
		printf("%lld %lld %lld\n",vec[i].fr,vec[i].sc.fr,vec[i].sc.sc);
	}
}
