import java.util.Scanner

import scala.collection.mutable

object Main extends App {
  val sc = new Scanner(System.in)
  val n = sc.nextInt()
  val m = sc.nextInt()
  val heights = new mutable.HashMap[Int, Int]()
  (1 to n).foreach { i =>
    val h = sc.nextInt()
    heights.put(i, h)
  }
  val lines = (1 to m).map { _ => Line(sc.nextInt(), sc.nextInt()) }
  val groupedLines = new mutable.HashMap[Int, List[Int]]
  addGroupedLines(lines)
  val result = (1 to n).count { i =>
    val height = heights(i)
    val tos = groupedLines.getOrElse(i, Nil)
    val result = tos.forall { to => heights(to) < height }
    result
  }
  println(result)

  def addGroupedLines(lines: Seq[Line]): Unit = {
    lines.foreach { line =>
      groupedLines.put(line.a, line.b :: groupedLines.getOrElse(line.a, Nil))
      groupedLines.put(line.b, line.a :: groupedLines.getOrElse(line.b, Nil))
    }
  }
}

case class Line(a: Int, b: Int)
