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