import Data.List (sort)
import Data.Array

main :: IO ()
main = do
  (n : x : _) <- map read . words <$> getLine :: IO [Int]
  ss <- listArray (1, n) . sort . map read . words <$> getLine :: IO (Array Int Int)
  let
    fs = iterate next (0, id)
    next (i, f) = (succ i, \x -> (f (x `mod` (ss ! (succ i))) + i * f x) `mod` m)
  print . (snd . head . drop n $ fs) $ x

m :: Int
m = 10 ^ 9 + 7
