
func readArrayInt() -> [Int] {
    readLine()!.split(separator: " ").map({Int($0)!})
}

var line = readArrayInt()
let (N, M) = (line[0], line[1])
var peaks: Set<Int> = []
(0..<N).forEach({peaks.insert($0)})
let H = readArrayInt()

for _ in 1...M {
    let pair = readArrayInt()
    let (A, B) = (pair[0] - 1, pair[1] - 1)
    if H[A] < H[B] {
        peaks.remove(A)
    } else if H[A] > H[B] {
        peaks.remove(B)
    } else {
        peaks.remove(B)
        peaks.remove(A)
    }
}
print(peaks.count)
