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(G.count(x => H(x._1 - 1) >= x._2.maxBy(y => H(y - 1))))
}