fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }
    val h = readLine()!!.split(" ").map { it.toInt() }
    println(n - (1..m).map {
        val (a, b) = readLine()!!.split(" ").map { it.toInt() - 1 }
        if (h[a] > h[b]) listOf(b) else if (h[a] < h[b]) listOf(a) else listOf(a, b)
    }.flatten().filter { it != -1 }.toSet().size)
}
