M, K = gets.split.map(&:to_i)
if K >= 2**M
  puts -1
  exit
end
if M == 1
  if K == 0
    puts "0 0 1 1"
  else
    puts -1
  end
  exit
end
ans = []
for i in 0..2**M-1
  if i != K
    ans << i
  end
end
ans << K
for j in 1..2**M
  i = 2**M - j
  if i != K
    ans << i
  end
end
ans << K
puts ans