import Foundation

let input_line: String = readLine()!
let split: [String] = input_line.components(separatedBy: " ")

let n = Int(split[0])!
let m = Int(split[1])!

var maxs: [Int] = []

var nArray: [Int] = []

let input_line2: String = readLine()!
let split2: [String] = input_line2.components(separatedBy: " ")
for i in 0..<n {
    nArray.append(Int(split2[i])!)
}

for _ in 0..<m {
    let input_line3: String = readLine()!
    let split3: [String] = input_line3.components(separatedBy: " ")
    let a = Int(split3[0])!
    let b = Int(split3[1])!
    maxs[a] = max(maxs[a], nArray[b])
    maxs[b] = max(maxs[b], nArray[a])
}

var ans = 0

var i = 0
for max in maxs {
    if max < nArray[i] {
        ans += 1
    }
    i += 1
}

print(ans)