module Main where

import Data.List
import qualified Data.Set as Set

findSemiCommonMultiple :: Float -> Float -> [Float]
findSemiCommonMultiple m num
  | round num `mod` 2 /= 0 = []
  | otherwise = takeWhile (<=m) [ n | d <- [1..], let n = num * (d + 0.5), isInt n]
  -- seems like we have to do math here
  where
    isInt x = x == fromInteger (round x)

main =
  (map (read :: String -> Float) . words) <$> getLine >>= \[n, m] ->
  (map (read :: String -> Float) . words) <$> getLine >>= \arr ->
  let
    findSemiCommonMultipleOfM = findSemiCommonMultiple m
    result = map (Set.fromList . findSemiCommonMultipleOfM) (nub arr)
    semiCommonMultipleCount = length $ foldl Set.intersection (head result) (tail result)
  in putStrLn (show semiCommonMultipleCount)
