import java.util.*

fun main() {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    val m = sc.nextInt()
    val good = BooleanArray(n+1){true}
    val h = IntArray(n+1)
    good[0] = false
    for(i in 1..n) {
        h[i] = sc.nextInt()
    }

    for(i in 0 until m) {
        val a = sc.nextInt()
        val b = sc.nextInt()
        if(h[a] > h[b]) {
            good[b] = false
        } else if(h[a]==h[b]) {
            good[a] = false
            good[b] = false
        } else {
            good[a] = false
        }
     }

    print(good.count { it })

}