const { parse } = require("path");

function Main(input) {
    input = input.trim().split("\n").map(function(x) { return x.split(" ")});
    let N = parseInt(input[0][0], 10);
    let M = parseInt(input[0][1], 10);
    let bitVec = Array.from({length:N}, () => true);
    let H = input[1].map(e => parseInt(e, 10));
    let AB;
    for (let i = 0; i < M; i++){
        AB = input[i + 2].map(e => parseInt(e, 10));
        if (H[AB[0] - 1] > H[AB[1] - 1]){
            bitVec[AB[1] - 1] = false;
        } else if (H[AB[0] - 1] < H[AB[1] - 1]) {
            bitVec[AB[0] - 1] = false;
        } else {
            bitVec[AB[1] - 1] = false;
            bitVec[AB[0] - 1] = false;
        }
    }
    let ans = 0;
    for (let x of bitVec){
        if (x) ans++;
    }
    console.log(ans);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
