import Foundation

func readInt() -> [Int]{
    return readLine()!.split(separator:" ").map{Int($0)!}
}
let nm = readInt()
let hill = readInt()
var ans: Set<Int> = []
for _ in 1...nm[0]{
  let bridge = readInt()
  if hill[bridge[0] - 1] > hill[bridge[1] - 1] {
    ans.insert(bridge[1] - 1)
  }else if hill[bridge[0] - 1] < hill[bridge[1] - 1] {
    ans.insert(bridge[0] - 1)
  }else{
    ans.insert(bridge[0] - 1)
    ans.insert(bridge[1] - 1)
  }
}
print(nm[0] - ans.count)