fun main(args: Array<String>){
    val (m,k) = readLine()!!.split(" ").map(String::toLong)
    val t : Long = Math.pow(2.0,m.toDouble()).toLong()
    if(t<=k){
        println(-1)
        return
    }
    if(m==1L){
        if(k==0L) println("0 0 1 1")
        else println(-1)
        return
    }
    for (i in 0 until t) if(i!=k) print("$i ")
    print("$k ")
    for (i in (0 until t).reversed()) if(i!=k) print("$i ")
    print("$k")
    println()
}