PROGRAM ATCODER

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

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

b = 0
dp = 10**9
do i = 2,n
  call chmin(dp,a(i-1))
  b(i) = a(i) - dp
end do

maxb = maxval(b)
do i = 1,n
  if(b(i) == maxb)then
    ans = ans + 1
  end if
end do

write(*,'(i0)') ans

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

if (dp > x) then
  dp = x
  return
end if

end subroutine
!!!!!!

END PROGRAM ATCODER