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

case m
when 0
  if k == 0
    puts('0 0')
  else
    puts('-1')
  end
when 1
  if k == 0
    puts('0 0 1 1')
  else
    puts('-1')
  end
else
  (0...2**m).each do |i|
    printf("#{i} ") if i != k
  end

  printf("#{k} ")

  (0...2**m).reverse_each do |i|
    printf("#{i} ") if i != k
  end

  printf("#{k}\n")
end