let input = readLine()!.split(separator: " ").map { Int($0)! }
let N = input[0]
let M = input[1]
let H = readLine()!.split(separator: " ").map { Int($0)! }

var observatories = Array(repeating: true, count: N)
for _ in 0 ..< M {
    let root = readLine()!.split(separator: " ").map { Int($0)! }
    let A = root[0]
    let B = root[1]

    if H[A - 1] > H[B - 1] {
        observatories[B - 1] = false
    } else if H[B - 1] > H[A - 1] {
        observatories[A - 1] = false
    } else {
        observatories[A - 1] = false
        observatories[B - 1] = false
    }
}

print(observatories.filter { $0 }.count)
