import Data.List
import Control.Applicative

func (x:xs) Nothing Nothing = (x,x) : (func xs (Just x) (Just x))
func (x:xs) (Just mx) (Just mn) = (mx',mn') : (func xs (Just mx') (Just mn'))
  where
    mx' = max x mx
    mn' = min x mn
func [] _ _ = []

main :: IO ()
main = do
  [n,t] <- return . map (read::String->Int) . words =<< getLine
  a <- return . map (read::String->Int) . words =<< getLine

  let dat = reverse $ func (reverse a) Nothing Nothing
  let dat2 = zipWith (\x (a,b) -> a-x) (init a) (tail dat)
  let max' = maximum dat2

  print $ length $ filter (==max') dat2
  
