import qualified Data.ByteString.Char8 as BS
import Data.List
import Data.Maybe

readInts :: IO [Integer]
readInts = map (fst . fromJust . BS.readInteger) . BS.words <$> BS.getLine

readStrings :: IO [BS.ByteString]
readStrings = BS.words <$> BS.getLine

main :: IO ()
main = do
  (n:m:_) <- readInts
  a <- readInts
  print $ solve m a

solve :: Integer -> [Integer] -> Integer
solve m a
  | ans == 0 = 0
  | otherwise = ans + 1
  where
    ans = div (div m a') 2
    a' = div (foldr lcm 1 a) 2