import Data.List.Split
import Data.List

gcd' :: [Int] -> Int
gcd' (x:[]) = x
gcd' (x:y:[]) = gcd x y
gcd' (x:y:xs) = (gcd (gcd x y) (gcd' xs))

getMultipleInt :: IO [Int]
getMultipleInt = 
    getLine >>= \x ->
    (return . (map read)) $ splitOn " " x
    
diff :: [Int] -> [Int]
diff [] = []
diff (x:[]) = []
diff (x:y:[]) = [y-x]
diff (x:y:xs) = (y-x):(diff xs)
    
main = do
    base <- fmap (!! 1) getMultipleInt
    dat <- getMultipleInt
    let ls = sort (base:dat)
    let d = diff ls
    putStrLn . show $ gcd' d