import Control.Arrow
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector as V
import Control.Monad.State (State, evalState, runState, put, gets, modify)
import Data.Map.Strict (Map, lookup, insert, empty)
import Data.Foldable

main :: IO ()
main = readContents 2 >>= print . solve

solve :: [[Int]] -> Int
solve [[n, x0], ss] = evalMemo calc (x0, 0)
    where
        vs = V.fromList $ sort ss
        ps = V.fromList $ scanl mul 1 [1..n]

        calc _ (0, _) = return 0
        calc f (x, i)
            | x < vs V.! 0 = return $ (ps V.! (n - i)) `mul` x
            | otherwise = add <$> lowers <*> highers
            where
                m = edit $ binarySearch x vs 
                lowers = adds f [(x `mod` (vs V.! iy), i + 1) | iy <- [0..(m - 1)]]
                highers
                    | n - i - m > 0 = (mul (n - i - m)) <$> f (x, i + 1)
                    | otherwise = return 0

        adds f xs = mapM f xs >>= foldlM (\acc x -> return $ acc `add` x) 0

        edit (Right i) = i + 1
        edit (Left i ) = i

readLine :: IO [Int]
readLine = unfoldr (fmap (second (maybe B.empty snd . B.uncons)) . B.readInt) <$> B.getLine

readContents :: Int -> IO [[Int]]
readContents = flip replicateM readLine

infixl 6 `add`
infixl 7 `mul`

add :: Int -> Int -> Int
add x y = val $ x + y

mul :: Int -> Int -> Int
mul x y = val $ x * y

inv :: Int -> Int
inv x = pow x $ modVal - 2

pow :: Int -> Int -> Int
pow b e
    | e == 0 = 1
    | odd e = mul b . pow b $ e - 1
    | otherwise = mul v v
    where
        v = pow b $ e `div` 2

val :: Int -> Int
val = (`mod` modVal)

modVal :: Int
modVal = 10 ^ 9 + 7

primes :: [Int]
primes = build [2..]
    where
        build (x : xs) = x : build (filter (\n -> n `mod` x /= 0) xs)
        
isPrime :: Int -> Bool
isPrime n = check primes
    where
        check (x : xs)
            | x == n = True
            | x > n = False
            | otherwise = check xs

binarySearch :: (Ord a) => a -> V.Vector a -> Either Int Int
binarySearch k xs
    | V.null xs = Left 0
    | otherwise = bsf 0 $ V.length xs
    where
        bsf base size
            | size > 1 && mv > k = bsf base $ size - half
            | size > 1 = bsf mid $ size - half
            | bv == k = Right base
            | bv < k = Left $ base + 1
            | otherwise = Left base
            where
                half = size `div` 2
                mid = base + half
                bv = xs V.! base
                mv = xs V.! mid

type Memoizer a b = a -> State (Map a b) b

evalMemo :: (Ord a) => (Memoizer a b -> Memoizer a b) -> a -> b
evalMemo f = flip evalState empty . memoizeFix f

runMemo :: (Ord a) => (Memoizer a b -> Memoizer a b) -> a -> (b, Map a b)
runMemo f = flip runState empty . memoizeFix f

memoizeFix :: (Ord a) => (Memoizer a b -> Memoizer a b) -> Memoizer a b
memoizeFix f x = gets (Data.Map.Strict.lookup x) >>= maybe (f (memoizeFix f) x >>= ((<$) <*> (modify . Data.Map.Strict.insert x))) return