import sys input = lambda : sys.stdin.readline().rstrip() sys.setrecursionlimit(2*10**5+10) write = lambda x: sys.stdout.write(x+"\n") debug = lambda x: sys.stderr.write(x+"\n") writef = lambda x: print("{:.12f}".format(x)) n,k = list(map(int, input().split())) if (n-1)%k==0: print(-1) else: v = 10000 - 1 v2 = -5000 es = [] for i in range(1,n): if i%k==1: val = v else: val = v2 es.append((i,i+1,val)) write("\n".join((" ".join(map(str, item)) for item in es)))