program sample
implicit none
integer(8) N,M,A(10**5),B(10**5),i,count1
integer(16) H(10**5),H2(10**5)
read(*,*) N,M
read(*,*)(H(i),i=1,N)
do i=1,M
read(*,*)A(i),B(i)
end do
do i=1,N
H2(i)=H(i)
end do
do i=1,M
if (H(A(i))<=H(B(i))) then
    H2(A(i))=0
end if
if (H(A(i))>=H(B(i))) then
    H2(B(i))=0
end if
end do
count1=0
do i=1,N
if (H2(i).ne.0) then
count1=count1+1
end if
end do
write(*,*) count1
stop
end program sample