n,m = map(int,input().split()) L = [sum(bin(i*j).count("1")%2 for j in range(1,n+1)) for i in range(1,n+1)] m += len(L) v = 1 dp = [1] for i in L: v |= v<>(m//2)&1==0: print(-1) exit() r = m//2 P = [] Q = [] for i,v in enumerate(L[::-1]): if r < v or dp[n-i-1]>>(r-v)&1==0: Q.append(n-i) else: P.append(n-i) r -= v print(len(P),len(Q)) print(*P) print(*Q)