program sample
implicit none

integer :: n, m
integer, allocatable :: h(:), a(:), b(:)
integer :: i, j
integer :: test, number

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

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

number = 0
do i = 1, n
test = 1
do j = 1, m
if (a(j) == i) then
if (h(b(j)) >= h(a(j))) then
test = test * 0
exit
end if
end if
if (b(j) == i) then
if (h(a(j)) >= h(b(j))) then
test = test * 0
exit
end if
end if
end do
if (test > 0) then
number = number + 1
end if
end do

write(*,*) number
stop
end program sample