program cm
   implicit none
   integer::N,M
   integer,allocatable,dimension(:)::H
   integer::a,b
   logical,allocatable,dimension(:)::GOOD
   integer::ans=0
   integer::i
   read*,N,M
   allocate(H(N))
   read*,H
   allocate(GOOD(N))
   GOOD=.true.
   do i=1,M
      read*,a,b
      if(H(b)>=H(a))GOOD(a)=.false.
      if(H(a)>=H(b))GOOD(b)=.false.
   end do
   do i=1,N
      if(GOOD(i))ANS=ANS+1
   end do
   print"(i0)",ans
contains
end program cm