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

if K == 0
  puts (0 .. M).flat_map{|i| [i, i]}.join(' ')
else
  as = [0] + (0 .. M).map{|i| 2**i}
  if as.inject(:^) == K
    puts (as * 2).join(' ')
  else
    puts '-1'
  end
end