object Main extends App {
  import java.util.Scanner
  import scala.collection.mutable.ArrayBuffer
  val sc = new Scanner(System.in)
  val n = sc.nextInt()
  val m = sc.nextInt()
  val h = (1 to n).map { i =>
    sc.nextInt()
  }
  val flags = ArrayBuffer.fill(n)(true)
  (1 to m).foreach { _ =>
    val a = sc.nextInt() - 1
    val b = sc.nextInt() - 1
    val ha = h(a)
    val hb = h(b)
    if (ha == hb) {
      flags(a) = false
      flags(b) = false
    } else if (ha > hb) {
      flags(b) = false
    } else {
      flags(a) = false
    }
  }

  val result = flags.count(_ == true)
  println(result)
}
