fun main() = abc166c()

@OptIn(ExperimentalStdlibApi::class)
fun abc166c() {
    val (n, m) = readLine()!!.split(' ').map { it.toInt() }
    val hList = readLine()!!.split(' ').map { it.toLong() }.toLongArray()
    val abList = (1..m).map { readLine()!!.split(' ').map { it.toInt() - 1 } }

    val good = BooleanArray(n) { true }

    for ((a, b) in abList) {
        if (hList[a] <= hList[b]) good[a] = false
        if (hList[b] <= hList[a]) good[b] = false
    }

    val answer = good.count { it }

    println(answer)
}
