fun main(args: Array<String>) {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val h = readLine()!!.split(" ").map { it.toLong() }
    var g = Array<MutableList<Int>>(n){ mutableListOf() }
    for(i in 0 until m){
        val (a,b) = readLine()!!.split(" ").map { it.toInt() }
        g[a-1].add(b-1)
        g[b-1].add(a-1)
    }
    var cnt = 0
    loop@for(i in 0 until n){
        for(el in g[i]){
            if(h[i] <= h[el] )
                continue@loop
        }
        cnt++
    }
    println(cnt)
}