fun main() {
    val l = readLine()!!.split(' ').map { it.toInt() }
    val h = readLine()!!.split(' ').map { it.toInt() }
    var list: MutableMap<Int, Int> = mutableMapOf()
    for (i in 0 until l[0]) {
        list[i] = 0
    }

    for (i in 0 until l[1]) {
        val ab = readLine()!!.split(' ').map { it.toInt()-1 }
        if (h[ab[0]] > h[ab[1]]) {
            list[ab[1]] = list[ab[1]]!! + 1
        } else if (h[ab[0]] < h[ab[1]]) {
            list[ab[0]] = list[ab[0]]!! + 1
        } else {
            list[ab[1]] = list[ab[1]]!! + 1
            list[ab[0]] = list[ab[0]]!! + 1
        }
    }

    val res = list.filter { it.value == 0 }.count()
    println(res)
}

