import java.util.*

fun main(args: Array<String>) {
  val sc = Scanner(System.`in`)
  val n = sc.nextInt()
  val m = sc.nextInt()
  val h = (1..n).map {
    sc.nextInt()
  }
  val ab = (1..m).map {
    Pair(sc.nextInt(), sc.nextInt())
  }

  println(abc166c(n, m, h, ab))
}

private fun abc166c(n: Int, m: Int, h: List<Int>, ab: List<Pair<Int, Int>>): Int {
  val hArray = IntArray(n) { 0 }
  var i = 0
  for (hi in h) {
    hArray[i] = hi
    i++
  }
  val ans = BooleanArray(n) { true }

  for (abi in ab) {
    val a = abi.first - 1
    val b = abi.second - 1
    val ha = hArray[a]
    val hb = hArray[b]
    if (ha < hb) {
      ans[a] = false
    } 
    if (ha > hb) {
      ans[b] = false
    }
    if (ha == hb) {
      ans[a] = false
      ans[b] = false
    }
  }

  return ans.filter { it }.size
}
