computeGreatestCommonFactor :: [Int] -> Int
computeGreatestCommonFactor list = foldr1 gcd list

main :: IO ()
main = do
  [number, start] <- map read . words <$> getLine
  positions <- map read . words <$> getLine
  let distances = map (abs . (\x -> x - start)) positions
  let greatestCommonFactor = computeGreatestCommonFactor distances
  print greatestCommonFactor