function main(arg) {
    let tmp = arg.trim().split("\n")[0]
    let N = Number(tmp.split(" ")[0])
    let M = Number(tmp.split(" ")[1])
    let H = arg.trim().split("\n")[1].split(" ").map(Number)
    tmp = arg.trim().split("\n")
    tmp.shift()
    tmp.shift()
    // let AB = tmp.map(e => e.split(" ").map(Number))
    let ans = new Array(H.length).fill(true)
    for (let i = 0; i < tmp.length; i++) {
        let row = tmp[i].split(" ").map(Number)
        let Ai = row[0] - 1
        let Bi = row[1] - 1
        let A = H[Ai]
        let B = H[Bi]
        if (A >= B) {
            ans[Bi] = false
        }
        if (B >= A) {
            ans[Ai] = false
        }
    }
    let counter = 0
    for (let i = 0; i < ans.length; i++) {
        if (ans[i]) {
            counter++
        }
    }
    // console.log(ans)
    console.log(counter)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));