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

m = 2 ** M - 1

if K > m || (M == 1 && K == 1)
  puts -1
  exit
end

list = [*0..m]

if K == 0
  puts (list + list.reverse).join(' ')
else
  list[m], list[K] = list[K], list[m]

  (K + 1).upto(m) do |n|
    list << n
  end

  (K - 1).downto(0) do |n|
    list << n
  end

  list << K

  puts list.join(' ')
end

