main :: IO ()                                                                                                              
main = do                                                                                                                  
  [_, x] <- map (read :: String -> Int) . words  <$> getLine                                                               
  xs <- map (read :: String -> Int) . words  <$> getLine                                                                   
                                                                                                                           
  let diffX = map (abs . ((-) x)) xs                                                                                       
      gcdX = foldr getGcd 0 diffX                                                                                          
                                                                                                                           
  putStrLn $ show gcdX                                                                                                     
                                                                                                                           
getGcd :: Int -> Int -> Int                                                                                                
getGcd a 0 = a                                                                                                             
getGcd a b                                                                                                                 
  | a `mod` b == 0 = b                                                                                                     
  | otherwise = getGcd b $ a `mod` b 