import Data.List
factor 1 = [1]
factor x = reverse $sort $nub $1:inFactor [] [1] 2 x
 where
  inFactor fadd all begin x
   | x == begin       = fadd++(x:map (*begin) all)
   | mod x begin == 0 = let bye = begin:map (*begin) all in inFactor (fadd++bye)  bye begin (div x begin)
   | otherwise        = inFactor fadd all (begin+1) x
-- factor x = x:[y|y<-[div x 2,div x 2 -1..1],mod x y == 0]

check [1] _ = 1
check (x:xs) list = if null (filter ((0/=) . flip mod x) list) then x else check xs list

main = do
 [n,x] <- map read . words <$> getLine :: IO [Int]
 xs <- map read. words <$> getLine
 let list = map (flip(-)(minimum (x:xs))) $ sort (x:xs)
 print $ check (factor (head $ tail list)) $ drop 2 list