program main
    implicit none
    integer n,m
    integer, allocatable, dimension(:) :: h, a, b, ex
    integer i,j,k,sum

    read(*,*) n, m
    allocate(h(n))
    allocate(a(m))
    allocate(b(m))
    allocate(ex(n))

    do i = 1,n
        ex(i) = 0
    end do

    read(*,*) h
    do i = 1,m
        read(*,*) a(i), b(i)
        if(h(a(i)) > h(b(i))) then
            ex(b(i)) = 1
        else if (h(a(i)) < h(b(i))) then
            ex(a(i)) = 1
        else if (h(a(i)) == h(b(i))) then
            ex(a(i)) = 1
            ex(b(i)) = 1
        end if
    end do

    sum = 0
    do i = 1,n
        sum = sum + ex(i)
    end do

    write(*,*) n-sum


end program