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 bridge = readLine()!.split(separator:" ").map{Int($0)!}
  if (hill[bridge[0] - 1] > hill[bridge[1] - 1]){
    ans.insert(bridge[1])
  }else if (hill[bridge[0] - 1] < hill[bridge[1] - 1]) {
    ans.insert(bridge[0])
  }else{
    ans.insert(bridge[0])
    ans.insert(bridge[1])
  }
}
print(nm[0] - ans.count)