#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define IT iterator
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define UPD(x,y) (((x)+=(y))>=mo?x-=mo:233)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
#define debug puts("wzpakking")
using namespace std;
const int N=100005;
int n,k,a[N],b[N],c[N];
int main(){
	scanf("%d%d",&n,&k);
	int l1=n/2,l2=n-n/2;
	For(i,0,l2-1) a[i]=k+i,b[i]=k+2*n-1-i*2,c[i]=k+3*n-l1-i-1;
	For(i,0,l1-1) a[i+l2]=k+l2+i,b[i+l2]=k+2*n-2-i*2,c[i+l2]=k+3*n-i-1;
	For(i,0,n-1) if (a[i]+b[i]>c[i]) return puts("-1"),0;
	For(i,0,n-1) printf("%d %d %d\n",a[i],b[i],c[i]);
}
/*
K+L,K+4N-2L  K+4N-L K+6N-L
K+N+L,K+4N-2L-1 K+5N-L

*/