let first = readLine()!.split(separator: " ")
let N = Int(first[0])!
let M = Int(first[1])!
let heights: [Int] = readLine()!.split(separator: " ").map { Int($0)! }
var graph: [Set<Int>] = .init(repeating: Set<Int>(), count: N)
for _ in 0..<M {
  let read = readLine()!.split(separator: " ")
  let source = Int(read[0])!
  let dest = Int(read[1])!
  graph[source - 1].insert(dest - 1)
  graph[dest - 1].insert(source - 1)
}

var count = 0
for i in 0..<N {
  var result = true
  for nei in graph[i] {
    if heights[i] <= heights[nei] {
      result = false
      break
    }
  }
  if result {
    count += 1
  }
}
print(count)

