const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {

    const rows = input.split('\n')
    const [N, M] = rows[0].split(' ').map(Number)
    const H = rows[1].split(' ').map(Number)
    const A = [], B = []
    for (let i = 0; i < M; i++) {
        [A[i], B[i]] = rows[i + 2].split(' ').map(Number)        
    }

    const dp = [...Array(N).fill(1)]
    
    for (let i = 0; i < M; i++) {
        if (H[A[i] - 1] === H[B[i] - 1]) {
            dp[A[i] - 1] = 0
            dp[B[i] - 1] = 0
        } else if (H[A[i] - 1] < H[B[i] - 1]) {
            dp[A[i] - 1] = 0
        } else {
            dp[B[i] - 1] = 0
        }
    }
    
    console.log(dp.reduce((a, b) => a + b))
    
})(input)
