object Main extends App{
  import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}
  val in=new BufferedReader(new InputStreamReader(System.in))
  val out = new PrintWriter(new BufferedOutputStream(System.out))
  val Array(n,m) = in.readLine().split(" ").map(_.toInt)
  val h = in.readLine().split(" ").map(_.toInt)
  var map=scala.collection.mutable.HashMap[Int,Int]()
  for{i <- (0 until m)}{
    val Array(a, b) = in.readLine().split(" ").map(_.toInt)
    if(h(a-1) < h(b-1)){
      map(a) = if(map.contains(a)) map(a) + 1 else 1
    }
    if(h(a-1) > h(b-1)){
      map(b) = if(map.contains(b)) map(b) + 1 else 1
    }
    if(h(a-1) == h(b-1)){
      map(a) = if(map.contains(a)) map(a) + 1 else 1
      map(b) = if(map.contains(b)) map(b) + 1 else 1
    }
  }
  out.println(n - map.toSeq.size)
  out.flush()
}