#include<bits/stdc++.h>
using namespace std;
//#define int long long
const int N=1000002,M=998244353;
#define For(i,x,y) for(register int i=(int)(x);i<=(int)(y);i++)
#define Rep(i,x,y) for(register int i=(int)(x);i>=(int)(y);i--)
int pw(int x,int y){int z=1;for(;y;y>>=1,x=1ll*x*x%M)if(y&1)z=1ll*z*x%M;return z;}
int n,K,i,a[N],b[N],c[N];
signed main(){
	scanf("%d%d",&n,&K);
	if (K>(n+1)/2) return puts("-1"),0;
	for (i=1;i<=n;i++) a[i]=K+i-1,b[i]=a[i]+n,c[i]=b[i]+n;
	if (n&1){
		K=n/2;
		For(i,1,K+1) printf("%d %d %d\n",a[i],b[i+K],c[2*i-1]);
		For(i,K+2,n) printf("%d %d %d\n",a[i],b[i-K-1],c[(i-K-1)*2]);
	}else{
		K=n/2;
		For(i,1,K) printf("%d %d %d\n",a[i],b[i+K],c[2*i-1]);
		For(i,K+1,n) printf("%d %d %d\n",a[i],b[i-K],c[(i-K)*2]);
	}
}