import Foundation
let nm = readLine()!.split(separator:" ").map{Int($0)!}
let hill = readLine()!.split(separator:" ").map{Int($0)!}
var ans: Set<Int> = []
for _ in 1...nm[1]{
  let ab = readLine()!.split(separator:" ").map{Int($0)!}
  if hill[a-1] < hill[b-1]{
    ans.insert(a-1)
  }
  else if h[a-1] > h[b-1]{
    ans.insert(b-1)
  }
  else{
    ans.insert(a-1)
    ans.insert(b-1)
  }
}
print(n-ans.count)