import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}
import scala.collection.mutable.{Map, Stack, Queue, PriorityQueue, Set}

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

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

  val graph = Array.fill[List[Int]](N+1)(Nil)
  for (i <- 1 to M) {
    val A, B = in.next().toInt
    graph(A) = B :: graph(A)
    graph(B) = A :: graph(B)
  }

  val H = _H.sorted.reverse

  // 
  val dp = new Array[Boolean](N+1)
  var ans = 0
  for ((h, node) <- H) {
    if (!dp(node)) {
      ans += 1

      dp(node) = true

      var flag = false
      for (e <- graph(node)) {
        if (!dp(e))
          dp(e) = true

        // 同一 h のチェック
        if (high(e) >= h)
          flag = true
      }

      if (flag)
        ans -= 1
    }
  }

  println(ans)

}

object Sub {
  def print2DimArray[A](mat: Array[Array[A]]): Unit = {
    mat.foreach(lin => println(lin.toList))
  }
}

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()
  }
}
