import Control.Applicative
import Data.List (sortBy,nub)

getDiffs :: [(Int,Int)] -> (Int,[Int]) -> [(Int,(Int,[Int]))]
getDiffs [] _ = []
getDiffs ((i,a):as) (m,js) = (a-m,(i,js)):getDiffs as nm
  where nm | a < m = (a, [i])
           | m == a = (m, i:js)
           | otherwise = (m, js)

main = do
  [n,t] <- map read.words <$> getLine :: IO [Int]
  as <- map read.words <$> getLine :: IO [Int]
  let diffs = sortBy (flip compare) $ getDiffs (zip [1..] (tail as)) (head as,[0])
      maxDiff = fst $ head diffs
      maxDiffs = takeWhile ((==maxDiff).fst) diffs
      maxDiffLargeLength = length maxDiffs
      maxDiffSmallLength = length.nub $ concatMap (snd.snd) maxDiffs
  print $ min maxDiffLargeLength maxDiffSmallLength
