#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i, x, n) for (int i = x; i < (int)(n); ++i)
 
int main(){
	int n, k;
	scanf("%d%d", &n, &k);
	if (n + 1 < k << 1){
		printf("-1\n");
		return 0;
	}
	for (int i = n - 1, j = n - 1, w = n >> 1; j >= 0; --i, j -= 2, ++w)printf("%d %d %d\n", k + w, k + n + j, k + 2 * n + i);
	for (int i = n / 2 - 1, j = n - 2, w = 0; j >= 0; --i, j -= 2, ++w)printf("%d %d %d\n", k + w, k + n + j, k + 2 * n + i);
}