fun main() {
    val (n, m) = readLine()!!.split(" ").map(String::toInt)
    val hn = readLine()!!.split(" ").map { it.toInt() }.toIntArray()

    val graph = mutableMapOf<Int, MutableList<Int>>()
    repeat(m) {
        readLine()!!.split(" ").map(String::toInt).let {
            graph.getOrPut(it[0] - 1, { mutableListOf() }).add(it[1] - 1)
            graph.getOrPut(it[1] - 1, { mutableListOf() }).add(it[0] - 1)
        }
    }


    var count = 0
    for (i in 0 until n) {

        val list = graph[i]
        if (list.isNullOrEmpty()) {
            count++
            continue
        }

        if (hn[i] > list.map { hn[it] }.max()!!){
            count++
        }
    }

    println(count)

}



