import Data.Foldable import Control.Applicative import Data.Monoid import Data.Foldable import Prelude hiding (maximum,minimum) instance Monoid a => Monoid (IO a) where mempty = return mempty mappend a b = mappend <$> a <*> b getLines::Int->IO String getLines 1 = getLine getLines n = getLine <> return "\n" <> (getLines$n-1) main = do n<-read<$>getLine::IO Int k<-read<$>getLine::IO Int list<-fmap read<$>lines<$> getLines n::IO [Int] print$maximum list - minimum list