M,K=gets.chomp.split(' ').map{|n| n.to_i}
if(K>=2**M)
	puts -1
	exit(0)
end
if(M==0)
	puts "0 0"
	exit(0)
elsif(M==1&&K==0)
	puts "0 0 1 1"
	exit(0)
elsif(M==1&&K==1)
	puts "-1"
	exit(0)
end
print "#{K} "
for i in 0..(K-1)
	print "#{i} "
end
for i in (K+1)..(2**M-1)
	print "#{i} "
end
print "#{K} "
(2**M-1).downto(K+1){|i|
	print "#{i} "
}
(K-1).downto(0){|i|
	print "#{i} "
}
puts ""
