import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val m = scanner.nextInt()
    val height = IntArray(n)
    val path = Array(m, {Pair<Int, Int>(0,0)})
    for(i in 0..n-1){
        height[i] = scanner.nextInt()
    }
    for(i in 0..m-1){
        var pair = Pair(scanner.nextInt(), scanner.nextInt())
        path[i] = pair
    }
    val good = Array(n, {1})
    for(i in 0..m-1){
        if(height[path[i].first-1] > height[path[i].second-1]){
            good[path[i].second-1]--
        }
        else if(height[path[i].first-1] < height[path[i].second-1]){
            good[path[i].first-1]--
        }
        else{
            good[path[i].first-1]--
            good[path[i].second-1]--
        }
    }
    var count = 0
    for(i in 0..n-1){
        if(good[i] > 0) count++
    }
    println(count)
}