program ABC166C
    implicit none
    integer(8)::N,M,i,A,B,ans
    integer(8),allocatable,dimension(:)::H,checked,C
    read*,N,M
    allocate(H(N))
    allocate(checked(N))
    allocate(C(N))
    read*,H
    C=0
    checked=0
    ans=0

    do i=1,M
        read*,A,B
        checked(A)=1
        checked(B)=1
        if(H(A)>H(B))then
            C(A)=1
            C(B)=0
        else if(H(B)>H(A))then
            C(B)=1
            C(A)=0
        end if
    end do

    do i=1,N
        if(C(i)==1.or.checked(i)==0)then
            ans=ans+1
        end if
    end do

    print'(i0)',ans
end program ABC166C