fun main(args: Array<String>) = println(run {
    val (n,m) = readLine()!!.split(" ").map { it.toInt() }
    val h = readLine()!!.split(" ").map { it.toInt() }
    val ab = (1..m).map { readLine()!!.split(" ").map { it.toInt() } }

    val g = Array(n) { mutableListOf<Int>() }
    ab.forEach {
        val (a,b) = it
        g[a-1].add(b-1)
        g[b-1].add(a-1)
    }

    g.mapIndexed { i, v ->
        v.all { h[i] > h[it] }
    }.count { it }

})