import Data.Int import Data.List import Data.Bits factorial 0 = 1 factorial x = factorial (x - 1) * x checkBit [] x = True checkBit (a:as) x = checkBit as a && x == x .&. a countGroup :: Integer -> Integer -> Integer countGroup n x = factorial (n - x') where x' = (fromIntegral (popCount x)) :: Integer ans x = x `mod` (10^9 + 7) main = do str1 <- getLine let [n, k] = map read $ words str1 :: [Integer] str2 <- if k /= 0 then getLine else return ("") let as = sort $ map read $ words str2 :: [Integer] result | k == 0 = factorial n | (checkBit as $ head as) == True = countGroup (n + 1) $ last as | otherwise = 0 print $ ans result