import math.max
object Main extends App {
    val Array(n, m) = io.StdIn.readLine.split(" ").map(_.toInt)
    val hs = io.StdIn.readLine.split(" ").map(_.toInt)
    val abs = for (_ <- 1 to m) yield io.StdIn.readLine.split(" ").map(_.toInt)

    val ma = Array.fill(n)(0)
    for (ab <- abs) {
        val indexA = ab.head-1
        val indexB = ab.last-1
        ma(indexA) = max(ma(indexA), hs(indexB))
        ma(indexB) = max(ma(indexB), hs(indexA))
    }

    var ans = 0
    for (i <- 0 until n) {
        if (hs(i) > ma(i)) ans+=1
    }
    println(ans)
}