
import System.IO
import Control.Applicative ((<$>))

main = do
  s1 <- getLine
  let (num:lim:_) = (\x -> read x :: Int) <$> words s1
  s2 <- getLine
  let towns = read <$> words s2
  (putStrLn . show . aoki . bestMarket) towns

betterMarket :: [Int] -> [(Int,Int)]
betterMarket [a] = []
betterMarket (a:b:xs) | a >= b = bestMarket (b:xs)
                      | otherwise = (a, maximum (b:xs)):(bestMarket (b:xs))

bestMarket :: [Int] -> [(Int,Int)]
bestMarket towns = sp <$> filter (msis m) cs
  where
    cs = withAmount <$> betterMarket towns
    withAmount (a,b) = (a,b,b-a)
    msis x (_,_,a) = a == x
    m = foldl f 0 cs
    f x (_,_,a) = max x a
    sp (a,b,c) = (a,b)


aoki :: [(Int,Int)] -> Int
aoki ls = length ls
