m, k = gets.split.map(&:to_i)


if k >= (1 << m)
  puts "-1"
elsif m == 0
  puts "0 0"
elsif k == 0
  a = (0...(1 << m)).to_a
  b = a + a.reverse
  puts b.join(' ')
else
  a = []

  hoge = 1 << m

  hoge.times do |i|
    a << i if i != k
  end

  a << k

  (hoge-1).downto(0) do |i|
    a << i if i != k
  end

  a << k

  puts a.join(' ')
end
