import java.util.Scanner
import scala.io.StdIn._

object Main extends App {

  val Array(n, m) = readLine().split(" ").map(_.toInt)
  val H = readLine().split(" ").map(_.toInt)
  val A = Array.fill(m)(readLine().split(" ").map(_.toInt - 1))


  def solve() = {
    val hMaxArr = Array.fill(n)(0)

    A.foreach { root =>
      val s = root(0)
      val e = root(1)
      hMaxArr(s) = Math.max(hMaxArr(s), H(e))
      hMaxArr(e) = Math.max(hMaxArr(e), H(s))
    }
    (0 until n).foldLeft(0L) { case (acc, index) =>
      if(H(index) > hMaxArr(index)) acc+1 else acc
    }
  }

  println(solve())

}

