program peaks
  implicit none
  integer :: n, m, h(100000) = 0, a, b, i, x = 0
  logical :: g(100000) = .true.
  read(*,*) n, m
  read(*,*) h(1:n)
  do i = 1, m
    read(*,*) a, b
    if (h(a) <= h(b)) g(a) = .false.
    if (h(b) <= h(a)) g(b) = .false.
  end do
  do i = 1, n
    if (g(i)) x = x+1
  end do
  write(*,'(i0)') x
end program peaks