    let main () =
        let m, k = Scanf.sscanf (read_line ()) "%d %d" (fun m k -> m, k) in
        if k >= 1 lsl m || m = 1 && k = 1 then print_endline "-1" else
        if k = 0 then (
            for i = 0 to (1 lsl m) - 1 do
                Printf.printf "%d %d " i i
            done;
            print_newline ()
        ) else (
            for i = 0 to (1 lsl m) - 1 do
                if i <> k then Printf.printf "%d " i
            done;
            Printf.printf "%d " k;
            for i = (1 lsl m) - 1 downto 0 do
                if i <> k then Printf.printf "%d " i
            done;
            Printf.printf "%d\n" k
        )
    in
    main ()