
fun main(args: Array<String>){

    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val heights = readLine()!!.split(" ").map{it.toInt()}
    val bad = BooleanArray(n)

    repeat(m){
        val (a, b) = readLine()!!.split(" ").map { it.toInt() }
        if(heights[b-1] > heights[a-1]){
            bad[a-1] = true
        } else if(heights[a-1] > heights[b-1]){
            bad[b-1] = true
        }
        else {
            bad[a-1 ] = true
            bad[b-1] = true
        }
    }

    println(bad.filter { !it }.count())
}

