object Main extends App {
  import java.util.Scanner
  val sc = new Scanner(System.in)
  val n = sc.nextInt()
  val m = sc.nextInt()
  val h = (1 to n).map { i =>
    sc.nextInt()
  }
  val ab = (1 to m).map { i =>
    val a = sc.nextInt() - 1
    val b = sc.nextInt() - 1
    (a, b)
  }

  val result = (0 until n)
    .map { i =>
      val hi = h(i)
      ab.collect {
          case (a, b) if a == i => b
          case (a, b) if b == i => a
        }
        .forall(c => h(c) < hi)
    }
    .count(_ == true)
  println(result)
}
