fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map(String::toInt)
    val Hn = readLine()!!.split(" ").map(String::toInt)
    val AB = (1..M).map{
        val (a, b) = readLine()!!.split(" ").map(String::toInt)
        Pair(a, b)
    }
    val junction = (1..N).map {
        0
    }.toMutableList()
    AB.map {
        val (a, b) = it
        junction[a - 1] = if(junction[a - 1] > Hn[b - 1]) {junction[a - 1]} else { Hn[b - 1] } 
        junction[b - 1] = if(junction[b - 1] > Hn[a - 1]) {junction[b - 1]} else { Hn[a - 1] }
    }
    Hn.indices.map {
        val h = Hn[it]
        (junction[it]) < h
    }.filter { it }.size.run(::println)
}