import java.io._
import java.util.StringTokenizer

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val N, M = in.next().toInt
  val high = new Array[Int](N+1)
  for (i <- 0 until N) {
    high(i+1) = in.next().toInt
  }

  val dp = Array.fill[Boolean](N+1)(true)
  dp(0) = false
  for (_ <- 1 to M) {
    val A, B = in.next().toInt
    dp(A) = high(A) > high(B)
    dp(B) = high(B) > high(A)
  }

  val ans = dp.count(identity)
  println(ans)

}

class InputReader(stream: InputStream) {
  private[this] val reader = new BufferedReader(new InputStreamReader(stream))
  private[this] var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
