M, K = gets.chomp.split(" ").map(&:to_i);

if K >= (2 ** M) then
  puts -1
elsif M == 1 && K == 1 then
  puts -1
else
  a = []
  (0...2 ** M).each{|i|
    next if i == K
    a << i
  }
  a.shuffle!
  a.each{|i| printf("#{i} ")}
  printf("#{K} ")
  a.reverse.each{|i| printf("#{i} ")}
  printf("#{K} ")
end
