let inp = readLine()!.split(separator: " ").map { Int($0)! }
let (N, M) = (inp[0], inp[1])
let Hs = readLine()!.split(separator: " ").map { Int($0)! }
let roads = (1...M).map { _ -> (Int, Int) in
    let s = readLine()!.split(separator: " ").map { Int($0)! }
    return (s[0], s[1])
}

let dic0 = Dictionary(grouping: roads) { $0.0 }
let dic1 = Dictionary(grouping: roads) { $0.1 }

var r = 0
hr: for (i, h) in Hs.enumerated() {
    let js = (dic0[i+1] ?? []).map { $0.1 }
    if js.contains(where: { Hs[$0-1] >= h }) {
        continue
    }
    let ks = (dic1[i+1] ?? []).map { $0.0 }
    if ks.contains(where: { Hs[$0-1] >= h }) {
        continue
    }
    r += 1
}

print(r)
