func main() {
    let inputs = readLine()!.split(separator: " ")
    let N = Int(inputs[0])!
    let M = Int(inputs[1])!
    // print("N: \(N)")
    // print("M: \(M)")
    let H = readLine()!.split(separator: " ").map { Int($0)! }
    var nums = Array(repeating: 1, count: N)
    for _ in 0..<M {
        let inputs = readLine()!.split(separator: " ")
        let A = Int(inputs[0])!
        let B = Int(inputs[1])!
        let Ha = H[A - 1]
        let Hb = H[B - 1]

        if Ha < Hb {
            nums[A - 1] = 0
        }
        if Ha > Hb {
            nums[B - 1] = 0
        }
        if Ha == Hb {
            nums[A - 1] = 0
            nums[B - 1] = 0
        }
    }
    let output = nums.filter { $0 == 1 }.count
    print(output)    
}

main()
