import qualified Data.ByteString.Lazy.Char8 as B
import Data.Maybe

main :: IO ()
main =
  putStr . unlines . map (unwords . map show)
  . calcAnsG
  . map (map (fst . fromJust . B.readInt) . B.words) . B.lines
  =<< B.getContents

calcAnsG :: [[Int]] -> [[Int]]
calcAnsG [[n, _, w], as] = [[calcAns n w as]]

calcAns :: Int -> Int -> [Int] -> Int
calcAns 1 w [a] = abs (w - a)
calcAns n w as = abs (w - a) `max` abs (b - a)
  where a : b : _ = reverse as
