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

if k >= 1 << m
  puts '-1'
elsif m == 1
  puts k == 0 ? '1 0 0 1' : '-1'
elsif m == 0
  puts '0 0'
else
  a = 0.upto((1 << m) - 1).reject { |n| n == k } + [k] + ((1 << m) - 1).downto(0).reject { |n| n == k } + [k]
  puts a.join(' ')
end
