PROGRAM ATCODER

implicit none
integer :: n,t,i,num,dp,ans=0
integer,allocatable :: a(:)

read(*,*) n,t
allocate(a(n))
read(*,*) (a(i), i=1,n)

dp = 0
num = 1
do i = 1,n
  call chmax(dp,maxval(a(i:n))-a(i),num,i)
end do

do i = 1,n
  if(maxval(a(i:n))-a(i) == dp)then
    ans = ans + 1
  end if
end do

write(*,'(i0)') ans

contains
!!!!!! サブルーチンは↓
subroutine chmax(dp,x,num,i)
implicit none
integer :: dp, x, num, i

if (dp < x) then
  dp = x
  num = i
  return
end if

end subroutine
!!!!!!

END PROGRAM ATCODER