open Printf open Scanf
open Array

let si = string_of_int
let print_list f ls = List.iter (fun v -> printf "%s " @@ f v) ls
let pow n k =
  let rec f a n = function
  | 0 -> a | 1 -> n*a | k when k mod 2 = 0 -> f a (n*n) (k/2) | k -> f (a*n) (n*n) (k/2)
  in f 1 n k
let no () = print_int @@ -1

let () = scanf " %d %d" @@ fun m k ->
  let w = pow 2 m in
  if w <= k then no ()
  else if m=0 then (
    if k=0 then (
      print_list si [0;0]
    ) else no ()
  ) else if m=1 then (
    if k=0 then (
      print_list si [0;0;1;1]
    ) else no ()
  ) else (
    let ls =
      init w (fun i -> i)
      |> Array.to_list
      |> List.filter (fun v -> v <> k)
    in
    print_list si ls;
    printf "%d " k;
    print_list si @@ List.rev ls;
    printf "%d " k;
  )
