m,k = gets.split.map(&:to_i)
if k >= 2**m || (m == 1 && k == 1)
    puts "-1"
else
    a = []
    used = Array.new(2**m,false)
    used[k] = true
    for i in 0..m-1
        if k[i] == 1
            a.push(2**i)
            used[2**i] = true
        end
    end
    ans = [k]
    (2**m).times do |i|
        ans << i if used[i] == false
    end
    ans += a
    (2**m).times do |i|
        ans << 2**m-i-1 if used[2**m-i-1] == false
    end
    ans << k
    ans += a.reverse
    puts ans.join(" ")
end