main = do
    [n, m] <- map read <$> words <$> getLine :: IO [Integer]
    a <- map read <$> words <$> getLine :: IO [Integer]
    let p = foldl1 lcm $ map (`div` 2) a
    print $ if ok a then (m + p) `div` (p * 2) else 0

ok a | all odd a  = True
     | all even a = ok $ map (`div` 2) a
     | otherwise  = False
