fun main(args: Array<String>) {
  val (N, M) = readInts()
  val HN = readInts()
  val AB = (1..M).map { readInts() }

  val badSet = mutableSetOf<Int>()

  AB.forEach {
    val a = it[0] - 1
    val b = it[1] - 1
    val ha = HN[a]
    val hb = HN[b]
    if (ha > hb) {
      badSet.add(b)
    }
    if (hb > ha) {
      badSet.add(a)
    }
    if (hb == ha) {
      badSet.add(a)
      badSet.add(b)
    }
  }

  println(N - badSet.size)
}

fun readString() = readLine()!!
fun readStrings() = readString().split(" ")
fun readInt() = readString().toInt()
fun readLong() = readString().toLong()
fun readInts() = readStrings().map { it.toInt() }
fun readLongs() = readStrings().map { it.toLong() }
