program main
      implicit none
      integer(4) :: n, m, i, cnt
      integer(8), allocatable :: h(:)
      integer(4), allocatable :: a(:), b(:), tmp(:)

      read *, n, m
      allocate( h(n) )
      read *, h

      allocate( a(m) )
      allocate( b(m) )

      allocate( tmp(m) )
      tmp(:) = 0
      do i = 1, m
        read *, a(i), b(i)
        tmp(a(i)) = tmp(a(i)) + 1
        tmp(b(i)) = tmp(b(i)) + 1
      end do

      do i = 1, m
        if ( h(a(i)) > h(b(i)) ) then
          tmp(a(i)) = tmp(a(i)) - 1
        else if ( h(a(i)) < h(b(i)) ) then
          tmp(b(i)) = tmp(b(i)) - 1
        else if ( h(a(i)) == h(b(i)) ) then
        end if
      end do

      cnt = 0
      do i = 1, n
        if ( tmp(i) == 0 ) then
          cnt = cnt + 1
        end if
      end do

      print *, cnt

end program main
