fun main(args: Array<String>) {
    val (N, M) = readLine()!!.split(" ").map(String::toInt)
    var ans = 0
    val H: MutableList<Int> = readLine()!!.split(" ").map(String::toInt).toMutableList()
    var X: MutableList<Int> = mutableListOf()
    for (i in 1..N) {
        X.add(0)
    }
    for (i in 1..M) {
        val (A, B) = readLine()!!.split(" ").map(String::toInt)
        if (H[A - 1] == H[B - 1]) {
            X[A - 1] = -1
            X[B - 1] = -1
        } else if (H[A - 1] < H[B - 1]) {
            X[A - 1] = -1
        } else {
            X[B - 1] = -1
        }
    }
    for (i in X) {
        if (i == 0) {
            ans += 1
        }
    }
    println(ans)
}