// 🐋💭
import Foundation

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

func main() {
    let nm = readInts()
    let (n, m) = (nm[0], nm[1])
    ///展望台の標高
    let aryElevation = readInts()
    var aryAns = [Bool](repeating: true, count: n)
    for _ in 0..<m {
        let ab = readInts()
        let (a, b) = (ab[0], ab[1])
        if aryElevation[a-1] <= aryElevation[b-1] {
            aryAns[a-1] = false
        }
        if aryElevation[b-1] <= aryElevation[a-1] {
            aryAns[b-1] = false
        }
        
    }
    print(aryAns.filter { $0 == true}.count)
}
main()
