import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val N, M = sc.nextInt
  val H = Array.fill(N)(sc.nextInt)
  val AB = Array.fill(M, 2)(sc.nextInt)

  val G = AB.groupBy(_(0)).map(x => x._1 -> x._2.map(_(1)).toSet) ++ AB.groupBy(_(1)).map(x => x._1 -> x._2.map(_(0)).toSet)

  println((1 to N).count(i => {
    !G.contains(i) || H(i - 1) > G(i).map(y => H(y - 1)).max
  }))
}