import Control.Monad import Control.Applicative import Data.List main ::IO() main=do n <- readLn ::IO Int k <- readLn ::IO Int input <- replicateM n (readLn ::IO Int) let ss = sort input putStrLn $ show $ (last ss) - (head ss)