M, K = gets.split.map(&:to_i)
N = (1<<M)-1

if M==1 then
  puts (if K==0 then puts '0 0 1 1' else -1 end)
  exit
end

if K>N then
  puts -1
  exit
end

L = (0..N).filter{|a| a!=K}.to_a
ans = [K] + L + [K] + L.reverse
puts ans.join(' ')
