   program abc166c
      implicit none
      integer(8)::n,m
      integer(8),allocatable::h(:),a(:),b(:),flag(:)
      integer(8)::i,j,ans

         read *, n,m
         allocate(h(n),a(m),b(m),flag(n))
         read *, h(1:n)

         do i=1,m
            read *, a(i),b(i)
         end do

         flag=1
         do i=1,m
            if ( h(a(i)) < h(b(i)) ) then
               if (flag(b(i))==0 .or. flag(b(i))==1) then
                  flag(b(i))=1
                  flag(a(i))=0
               end if
            else if ( h(a(i)) > h(b(i)) ) then
               if (flag(a(i))==0 .or. flag(a(i))==1) then
                  flag(a(i))=1
                  flag(b(i))=0
               end if
            else
               flag(a(i))=0;flag(b(i))=0
            end if
         end do

         ans=0
         do i=1,n
            if (flag(i)==1) ans=ans+1
         end do

         print *, ans

   end program abc166c