import Control.Monad
main :: IO()
main = do
  [n, x] <- toIntAll . words <$> getLine
  xs <- toIntAll . words <$> getLine
  let result = calcMaxD xs x
  print result

calcMaxD :: [Int] -> Int -> Int
calcMaxD [] x = error "error"
calcMaxD xs x = gcdAll $ map (abs . subtract x) xs

gcdAll :: [Int] -> Int
gcdAll (x:xs) = foldl gcd x xs

toIntAll :: [String] -> [Int]
toIntAll = map (read :: String -> Int)