program ABC166C
    implicit none
    integer(8)::N,M,i,ans,A,B
    integer(8),allocatable,dimension(:)::H,checked,C
    read*,N,M
    allocate(H(N))
    allocate(checked(N))
    allocate(C(N))
    read*,H
    C=0
    ans=0
    do i=1,M
        read*,A,B
        if(H(A)>H(B))then
            C(B)=1
        else if(H(A)<H(B))then
            C(A)=1
        else
            C(A)=1
            C(B)=1
        end if
    end do

    do i=1,N
        if(C(i)==0)ans=ans+1
    end do
    print'(i0)',ans
end program ABC166C