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 default = Map.empty[Int, Seq[Int]]
    val hAndRootMap = A.foldLeft(default) { (acc, root) =>
      val s = root(0)
      val e = root(1)
      acc
        .updated(s, e +: acc.getOrElse(s, Seq.empty))
        .updated(e, s +: acc.getOrElse(e, Seq.empty))
    }
    H.zipWithIndex.foldLeft(0L) { case (acc, (h, index)) =>
      hAndRootMap.get(index) match {
        case None => acc+1
        case Some(list) => if(list.map(H).forall(_ < h)) acc+1 else acc
      }
    }
  }

  println(solve())

}

