// Peaks

func main() {
    let nm = readLine()!.split(separator: " ").map{Int($0)!}
    let h = ("0 " + readLine()!).split(separator: " ").map{Int($0)!}
    var flugs: [Bool] = Array(repeating: true, count: nm[0] + 1)
    flugs[0] = false
    for _ in 0..<nm[1] {
        let aibi = readLine()!.split(separator: " ").map{Int($0)!}
        let ai = aibi[0]
        let bi = aibi[1]
        let ha = h[ai]
        let hb = h[bi]
        if ha == hb {
            flugs[ai] = false
            flugs[bi] = false
        } else if ha > hb {
            flugs[bi] = false
        } else {
            flugs[ai] = false
        }
    }
    print(flugs.filter{$0}.count.description)
}

main()