import java.util.*
import kotlin.math.*

private val readString: ()->String = {readLine()!!}
private val readInt: ()->Int = { readLine()!!.toInt() }
private val readListInt: ()->List<Int> = { readLine()!!.split(' ').map(String::toInt) }


fun main(args: Array<String>) {
    val (N, M) = readListInt()
    val H = readListInt()

    var good = BooleanArray(N){true}
    for(i in 0 until M) {
        var (A,B) = readListInt()
        A--; B--;

        if (H[A] > H[B]) {
            good[B] = false
        } else if (H[A] < H[B]) {
            good[A] = false
        } else {
            assert(H[A] == H[B])
            good[A] = false
            good[B] = false
        }
    }

    val ans = good.count({it})
    println(ans)
}
