"use strict";

const main = arg => {
    const input = arg.trim().split("\n");

    const [n, m] = input[0].split(" ").map(el => parseInt(el));
    const hs = input[1].split(" ").map(el => parseInt(el));
    hs.unshift(0) // dummy
    let tmp = {}
    for (let i = 2; i < input.length; i++) {
        let [a, b] = input[i].split(" ").map(el => parseInt(el))
        if (!tmp[a]) tmp[a] = {}
        tmp[a][b] = true
        if (!tmp[b]) tmp[b] = {}
        tmp[b][a] = true
    }
    const numIsolated = n - Object.keys(tmp).length
    let num = 0
    for(let i of Object.keys(tmp)){
        const baseHight = hs[i]
        let ret = true
        for(let otherKey of Object.keys(tmp[i])){
            if(baseHight <= hs[otherKey]){
                ret = false
                break
            }
        }
        if(ret){
            num++
        } 
    }
    console.log(num + numIsolated)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  