{-# LANGUAGE FlexibleContexts #-}

import Control.Monad
import Data.List

main = sol <$> get <*> get >>= print

get = map read . words <$> getLine

sol [n,t] (a:as)
  | max n t<3 = 1
  | otherwise = length $ elemIndices (maximum ds) ds
  where
  ds = map (uncurry subtract) . filter ((>0) . snd) . uncurry (:)
    $ foldl' f ((a,0),[]) as

f ((l,r),d) a
  | a<l && r==0 = ((a,r),d)
  | a<l         = ((a,0),(l,r):d)
  | a>r         = ((l,a),d)
  | otherwise   = ((l,r),d)
