{-# LANGUAGE BangPatterns #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Data.Int
import qualified Data.ByteString.Char8 as BS

main = do
  [m,k] :: [Int] <- map (read . BS.unpack) . BS.words <$> BS.getLine
  if k < 2^m
    then do if m == 1
              then -- k == 0
              putStrLn "0 0 1 1"
              else do let l = [0..2^m-1]
                          l' = filter (/= k) l
                      BS.putStrLn $ BS.unwords $ map (BS.pack . show) $ l' ++ [k] ++ reverse l' ++ [k]
    else putStrLn "-1"
