let () = Scanf.scanf "%d %d\n" @@ fun m k ->
  if 0 < k then
    if 1 lsl m <= k || ((1 lsl m) - 1) mod 4 <> 3 then print_endline "-1"
    else begin
      Printf.printf "%d " k;
      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;
    end
  else begin
    for i = 0 to (1 lsl m) - 1 do
      Printf.printf "%d " i
    done;
    for i = (1 lsl m) - 1 downto 0 do
      Printf.printf "%d " i
    done;
  end