object Main {


  def main(args: Array[String]): Unit = {

    val Array(n,m) = io.StdIn.readLine().split(" ").map(_.toInt)

    val hights = io.StdIn.readLine().split(" ").map(_.toInt)

    val roads = for(i <- 0 until m) yield {
      io.StdIn.readLine().split(" ").map(_.toInt)
    }

    val highest = new Array[Int](n)

    for(r <- roads) {
      highest(r(0)-1) = highest(r(0)-1) max hights(r(1) -1)
      highest(r(1)-1) = highest(r(1)-1) max hights(r(0) -1)
    }

    val a = (hights zip highest).count(t => t._1 > t._2)
    println(a)

  }


}