object Main extends App {
  val sc = new java.util.Scanner(System.in)
  val n, m = sc.nextInt
  val h = Seq.fill(n)(sc.nextInt)

  val good_t = mutable.Seq.fill(n)(true)

  for (_ <- 1 to m) {
    val a, b = sc.nextInt

    if (h(a - 1) > h(b - 1)) {
      good_t(b - 1) = false
    } else if (h(a - 1) < h(b - 1)) {
      good_t(a - 1) = false
    } else {
      good_t(a - 1) = false
      good_t(b - 1) = false
    }
  }

  print(good_t.count(_ == true))
}
