fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(' ').map(String::toInt)
    val hList = readLine()!!.split(' ').map(String::toLong)
    val abList = (1..m).map {
        val (c, d) = readLine()!!.split(' ').map(String::toInt)
        Pair(c, d)
    }

    val goodArray = IntArray(n + 1) { 1 }
    goodArray[0] = 0
    for ((a, b) in abList) {
        if (hList[a - 1] <= hList[b - 1]) goodArray[a] = 0
        if (hList[a - 1] >= hList[b - 1]) goodArray[b] = 0
    }
    println(goodArray.count { it == 1 })
}
