import java.util.*

fun main() {
    val sc = Scanner(System.`in`)

    val n = sc.nextInt()
    val m = sc.nextInt()

    val isBads = BitSet(n)
    val h = Array(n) { sc.nextInt() }
    
    repeat(m) {
        val a = sc.nextInt()
        val b = sc.nextInt()
        val ah = h[a-1]
        val bh = h[b-1]

        if (ah <= bh) {
            isBads[a-1] = true
        }
        if (bh <= ah) {
            isBads[b-1] = true
        }
    }

    println((1..n).count { !isBads[it - 1] })
}
