import Foundation
let input = readLine()!.split(separator: " ").map { Int($0)! }

let M = input[0]
let K = input[1]

let N = 1 << M

if N <= K {
  print("-1")
} else if M == 1 && K != 0 {
  print("-1")
} else if M == 1 && K == 0 {
  print("0, 0, 1, 1")
} else {
	var list = (0..<N).map { $0 }
	list.remove(at: K)
	list = list + [K] + list.reversed() + [K]
  	print(list.map { String($0) }.joined(separator: " "))
}