import scala.io.StdIn.readLine
import scala.io.StdIn.readInt

object Main extends App {
    var inp = readLine.split(" ").map(_.toInt)
    val n = inp(0)
    val m = inp(1)
    val h = readLine.split(" ").map(_.toInt)
    var ok = Array.fill(n){1}
    for(i <- 0 to m) {
        val ab = readLine.split(" ").map(_.toInt);
        val a = ab(0)-1
        val b = ab(1)-1
        if(h(a)<=h(b)) ok(a)=0;
        if(h(a)>=h(b)) ok(b)=0;
    }
    print(ok.sum)
}