import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  // val a = new Array[Int](N)

  val M = in.next().toInt
  val K = in.next().toInt
  if (K == 0) {
    for (i <- 0 until 1 << M) {
      if (i == 0) {
        pw.print("0 0")
      }
      else
        pw.print(s" $i $i")
    }
    pw.println()
  }
  else if (M == 1 && K == 1){
    pw.println(-1)
  }
  else if (K < (1<<M)) {
    var hoge = List[Int]()
    for (i <- 0 until 1<<M if i != K)
      hoge = i :: hoge

    val ans = hoge ++ List(K) ++ hoge.reverse ++ List(K)
    pw.println(ans.mkString(" "))
  }
  else
    pw.println(-1)

  pw.flush()
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
