fun main() {
    val (n,m) = readLine()!!.split(" ").map(String::toInt)

    val h = readLine()!!.split(" ").map(String::toLong)

    val ab = Array(m){ //ab[1][0]
        readLine()!!.split(" ").map(String::toInt)
    }.sortedBy { it[0] }

    val flgs = Array(n){
        true
    }

    ab.forEach {
        if (h[it[0]-1] > h[it[1]-1]){
            flgs[it[1]-1] = false
        }else if(h[it[0]-1] < h[it[1]-1]){
            flgs[it[0]-1] = false
        }else{
            flgs[it[0]-1] = false
            flgs[it[1]-1] = false
        }
    }

    println("${flgs.count { it }}")

}