fun main() {
    val (n, m) = readLine()?.split(" ")?.map(String::toInt) ?: return
    val h = readLine()?.split(" ")?.map(String::toInt) ?: return
    val g = Array(n) { true }
    repeat(m) {
        val (a, b) = readLine()!!.split(" ").map(String::toInt)
        val aa = h[a - 1]
        val bb = h[b - 1]
        if (aa == bb) {
            g[a - 1] = false
            g[b - 1] = false
        }
        if (aa > bb) {
            g[b - 1] = false
        } else {
            g[a - 1] = false
        }
    }
    println(g.count { it }.toString())
}
