program sample
implicit none

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

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
allocate(test(n))
test = 1

do i = 1, m
if (h(a(i)) <= h(b(i))) then
test(a(i)) = test(a(i)) * 0
end if
if (h(b(i)) <= h(a(i))) then
test(b(i)) = test(b(i)) * 0
end if
end do

do i = 1, n
if (test(i) > 0) then
number = number + 1
end if
end do

write(*,*) number
stop
end program sample