object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val N, M = sc.nextInt()
  val H = Array.fill(N)(sc.nextInt())
  val flags = Array.ofDim[Boolean](N)
  for (_ <- 1.to(M)) {
    val A, B = sc.nextInt() - 1
    if (H(A) == H(B)) {
      flags(A) = true
      flags(B) = true
    } else if (H(A) < H(B)) {
      flags(A) = true
    } else {
      flags(B) = true
    }
  }
  println(flags.count(_ == false))
}
