import Foundation

let nm = readLine()!.split(separator:" ").map{Int($0)!}
let hill = readLine()!.split(separator:" ").map{Int($0)!}
var C = nm[0]
for _ in 1...nm[1]{
  let bridge = readLine()!.split(separator:" ").map{Int($0)! - 1}
  if(hill[bridge[1]] > hill[bridge[0]]){
    C -= 1
  }
}
print(C)