M,K = readline.chomp.split.map(&:to_i)

if M == 0
  if K == 0
    puts "0 0"
  else
    puts -1
  end
elsif M == 1
  if K == 0
    puts "0 1 1 0"
  else
    puts -1
  end
else
  if K < 2**M
    ans = []
    (2**M).times do |i|
      ans << i if i != K
    end
    a = ans + [K] + ans.reverse + [K]
    puts a.join(' ')
  else
    puts -1
  end
end

