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

if k >= 2 ** m
  puts -1
else
  if m == 0
    puts "0 0"
  elsif m == 1
    if k == 0
      puts "0 0 1 1"
    else
      puts -1
    end
  else
    0.upto(2**m - 1) do |i|
      next if i == k
      print "#{i} "
    end
    print "#{k} "
    (2**m - 1).downto(0) do |i|
      next if i == k
      print "#{i} "
    end
    puts k
  end
end
