You are given two positive integers N and K. Determine if the 3N integers K, K+1, ..., K+3N-1 can be divided into N triples (a1, b1, c1), ..., (aN, bN, cN) such that for each i from 1 to N, ai + bi ≤ ci holds. If possible, construct one such partition. If it is impossible to partition the integers satisfying the condition, print -1. If it is possible, print N triples in the format a1 b1 c1 : aN bN cN.

# Buggy version:
n, k = map(int, input().split())
if 2 * k > n + 1:
    exit(print(-1))
else:
    if n % 2 == 0:
        for i in range(n):
            if i % 2 == 0:
                print(i // 2 + k, (i + n * 3) // 2, i + n * 2 + k, end=" ")
            else:
                print(i // 2 + n // 2 + k, i // 2 + n + k, i + n * 2 + k, end=" ")
    else:
        for i in range(n):
            if i % 2 == 0:
                print(i // 2 + k, (i + n * 3) // 2, i + n * 2 + k, end=" ")
            else:
                print(i // 2 + n // 2 + k + 1, i // 2 + n + k, i + n * 2 + k, end=" ")

# Fixed version:
n, k = map(int, input().split())
if 2 * k > n + 1:
    exit(print(-1))
else:
    if n % 2 == 0:
        for i in range(n):
            if i % 2 == 0:
                print(k + i // 2, k + (i + n * 3) // 2, k + i + n * 2)
            else:
                print(k + i // 2 + n // 2, k + i // 2 + n, k + i + n * 2)
    else:
        for i in range(n):
            if i % 2 == 0:
                print(k + i // 2, k + (i + n * 3) // 2, k + i + n * 2)
            else:
                print(k + i // 2 + n // 2 + 1, k + i // 2 + n, k + i + n * 2)

# Buggy version:
n, k = map(int, input().split())
if n>1+2*k: print(-1)
else:
    for i in range(k): print(i+1, 2*k-i, 2*k+i+1)


# Fixed version:
n, k = map(int, input().split())
if 2*k > n+1:
	print(-1)
else:
	for i in range(n//2):
		print((2*k+n-2)//2 - i, k+n+1+2*i, k+2*n+i)
	for i in range(n-n//2):
		print(k+n-1-i, k+n+2*i, k+2*n+n//2+i)

# Buggy version:
n, k = map(int, input().split())
if 2 * k > n + 1:
    exit(print(-1))
else:
    if n % 2 == 0:
        for i in range(n):
            if i % 2 == 0:
                print(k + i // 2, (i + n * 3) // 2, k + i + n * 2)
            else:
                print(k + i // 2 + n // 2, k + i // 2 + n, k + i + n * 2)
        print()
    else:
        for i in range(n):
            if i % 2 == 0:
                print(k + i // 2, (i + n * 3) // 2, k + i + n * 2)
            else:
                print(k + i // 2 + n // 2 + 1, i // 2 + n + k, k + i + n * 2)

# Fixed version:
n,k = map(int,input().split())
if n % 2 == 0:
  if 2*k > n:
    print(-1)
  else:
    for i in range(n//2):
      print(k+2*i, k+(3*n)//2-1-i, k+2*n+i)
    for i in range(n//2):
      print(k+1+2*i, k+2*n-1-i, k+(5*n)//2+i)
else:
  if 2*k-1 > n:
    print(-1)
  else:
    for i in range((n+1)//2):
      print(k+2*i, k+(3*n-1)//2-i, k+2*n+i)
    for i in range((n-1)//2):
      print(k+1+2*i, k+2*n-1-i, k+(5*n+1)//2+i)

# Buggy version:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, K = getlist()
	if 2 * K - 1 > N:
		print(-1)
	else:
		if N % 2 == 1:
			ans = [[0, 0, 0] for i in range(N)]
			print(ans)
			for i in range(N):
				ans[i][2] = K + 2 * N + i
			for i in range(N):
				ans[(2 * i) % N][(2 * i) // N] = K + i
				ans[(2 * i + 1) % N][(2 * i + 1) // N] = K + N + i
		else:
			ans = [[0, 0, 0] for i in range(N)]
			for i in range(N):
				ans[i][2] = K + 2 * N + i
			n = N // 2
			for i in range(n):
				ans[2 * i][0] = K + i
				ans[2 * i + 1][0] = K + N + i
			for i in range(n, N):
				ans[2 * i - N][1] = K + N + i
				ans[2 * i + 1 - N][1] = K + i
		for i in range(N):
			print(" ".join(list(map(str, ans[i]))))

if __name__ == '__main__':
	main()

# Fixed version:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, K = getlist()
	if 2 * K - 1 > N:
		print(-1)
	else:
		if N % 2 == 1:
			ans = [[0, 0, 0] for i in range(N)]
			for i in range(N):
				ans[i][2] = K + 2 * N + i
			for i in range(N):
				ans[(2 * i) % N][(2 * i) // N] = K + i
				ans[(2 * i + 1) % N][(2 * i + 1) // N] = K + N + i
		else:
			ans = [[0, 0, 0] for i in range(N)]
			for i in range(N):
				ans[i][2] = K + 2 * N + i
			n = N // 2
			for i in range(n):
				ans[2 * i][0] = K + i
				ans[2 * i + 1][0] = K + N + i
			for i in range(n, N):
				ans[2 * i - N][1] = K + N + i
				ans[2 * i + 1 - N][1] = K + i
		for i in range(N):
			print(" ".join(list(map(str, ans[i]))))

if __name__ == '__main__':
	main()

# Buggy version:



def solve(N,K):
    if 2*K < N-1:
        print(-1)
        return

    def it():

        for i in range((N+1)//2):
            yield (K+i, K+N+i+N//2, K+N*2+i*2)
        for i in range(N//2):
            yield (K+(N+1)//2 + i, K+N+i, K+N*2+i*2+1)

    for a,b,c in it():
        print(a,b,c)

N,K = map(int,input().split())
solve(N,K)

# Fixed version:



def solve(N,K):
    if 2*K > N+1:
        print(-1)
        return

    def it():

        for i in range((N+1)//2):
            yield (K+i, K+N+i+N//2, K+N*2+i*2)
        for i in range(N//2):
            yield (K+(N+1)//2 + i, K+N+i, K+N*2+i*2+1)

    for a,b,c in it():
        print(a,b,c)

N,K = map(int,input().split())
solve(N,K)