fun main(args:Array<String>) {
    val (m,k) = readLine()!!.split(" ").map(String::toInt)
    if(m==1) {
        if(k==0) println("0 0 1 1")
        else println("-1")
    }
    else {
        if(k in 0 until (1 shl m)) {
            var ans = mutableListOf<Int>()    
            for(i in 0 until (1 shl m)) {
                if(i!=k) ans.add(i)
            }
            ans.add(k)
            for(i in (1 shl m)-1 downTo 0 ){
                if(i!=k) ans.add(i)
            }
            ans.add(k)
            println(ans.joinToString(separator=" "))

        }
        else {
            println("-1")
        }
    }
}