program main
    implicit none
    integer(8) n,m,h(100000),a,b,good(100000),ans,i
    read(*,*) n,m
    read(*,*) (h(i), i = 1, n)
    do i = 1, n
        good(i)=1
    end do
    do i = 1, m
        read(*,*) a,b
        if ( h(a)<=h(b) ) then
            good(a)=0
        end if
        if ( h(b)<=h(a) ) then
            good(b)=0
        end if
    end do
    ans=0
    do i = 1, n
        if ( good(i)==1 ) then
            ans=ans+1
        end if
    end do
    write(*,*) ans
end program main