fun main() {
	val (n,k) = readLine()!!.split(" ").map {it.toInt()}
	val t = readLine()!!.split(" ").map {it.toInt()}
	val f = BooleanArray(n)
	for(i in 1..k) {
		val (a,b) = readLine()!!.split(" ").map {it.toInt()-1}
		f[a] = f[a]||t[a]<=t[b]
		f[b] = f[b]||t[b]<=t[a]
	}
	println(f.count {!it})
}
