import java.util.Arrays

fun main(args: Array<String>) {
    val list = readLine()!!.split(" ").map(String::toInt)
    val N = list[0]
    val M = list[1]
    val heights = readLine()!!.split(" ").map(String::toInt)
    val goodT = Array<Boolean>(N, {true})

    repeat(M){
        val path = readLine()!!.split(" ").map(String::toInt)
        if (heights.get(path[0]-1) > heights.get(path[1]-1)){
            goodT[path[1]-1] = false
        }
        else if (heights.get(path[0]-1) == heights.get(path[1]-1)){
            goodT[path[1]-1] = false
            goodT[path[0]-1] = false
        }
        else {
            goodT[path[0]-1] = false
        }
    }
    println(Arrays.asList(*goodT).filter{it == true}.size)
}