import Data.List
import Control.Monad

f ::[Int]->Int->[Int]
f [] _=[]
f (x:xs) d=(x-d):f xs d

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

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

main = do
       a<-getLine
       b<-getLine
       let (n:x:[])=map read . words $ a::[Int]
           xs=sort $ map read . words $ b::[Int]
           ys=(f2 $ f xs x)
       putStrLn $ show $ f3 ys (head ys)