program main
  
  implicit none
  integer :: n, m, k, i, j
  integer, allocatable :: h(:), a(:),b(:), cnct(:)
  integer :: ans, maxh
  
  read(*,*) n,m
  allocate(h(n))
  allocate(a(m))
  allocate(b(m))
  allocate(cnct(n))
  read(*,*) h(i)
  cnct = 0
  do i = 1, m
    read(*,*) a(i), b(i)
    cnct(a(i)) = cnct(a(i)) + 1 
    cnct(b(i)) = cnct(b(i)) + 1 
  end do
  
  
  ans = 0
  maxh = maxval(h)
  do i = 1, n
    if( maxh == h(i) .or. cnct(i) == 0 ) ans = ans + 1 
  end do

  print*, ans
   
end program main
