program ABC166C
    implicit none
    integer n,m,k,j(2),l,x
    integer,allocatable::a(:),b(:),c(:)
    read(*,*) n,m
    allocate(a(n),b(n),c(n))
    b(1:n)=0
    c(1:n)=0
    read(*,*) a(1:n)
    do k=1,m
        read(*,*) j(1:2)
        if(a(j(1))>a(j(2))) b(j(2))=b(j(2))+1
        if(a(j(2))>a(j(1))) b(j(1))=b(j(1))+1
        if(a(j(2))==a(j(1))) c(j(1:2))=c(j(1:2))+1
    end do
    x=0
    do l=1,n
        if(b(l)==0 .and. c(l)==0) x=x+1
    end do
    write(*,*) x
end program ABC166C