fun main() {
    val (n, m) = readLine()!!.split(" ").map(String::toInt)
    val hList = readLine()!!.split(" ").map(String::toLong)
    val array = Array(n) { mutableListOf<Int>() }
    (0 until m).map {
        val (a, b) = readLine()!!.split(" ").map(String::toInt)
        array[a - 1].add(b - 1)
        array[b - 1].add(a - 1)
    }

    var count = n
    array.forEachIndexed { index, mutableList ->
        if (mutableList.isEmpty()) return@forEachIndexed

        val base = hList[index]
        mutableList.forEach {
            val height = hList[it]
            if (height >= base) {
                count -= 1
                return@forEachIndexed
            }
        }
    }

    println(count)
}