import scala.collection.mutable.ArrayBuffer
import scala.io.StdIn

object Main extends App {
  val Array(n, m) = StdIn.readLine().split(" ").map(_.toInt)
  val h = StdIn.readLine().split(" ").map(_.toInt)
  val g = new Array[ArrayBuffer[Int]](n).map(_ => new ArrayBuffer[Int](0).addOne(0))
  for (_ <- 0 until m) {
    val (x, y) = readIntPair
    g(x - 1) += h(y - 1)
    g(y - 1) += h(x - 1)
  }

  val cnt = g
    .zipWithIndex
    .map { case (list, v) => list.max < h(v) }
    .count(identity)

  println(cnt)

  def readIntPair: (Int, Int) = {
    val Array(x, y) = StdIn.readLine().split(" ").map(_.toInt)
    (x, y)
  }
}