function Main(_input) {
    const lines = _input.split("\n");
    const first = lines[0].split(' ');
    const dai = parseInt(first[0], 10);
    const road = parseInt(first[1], 10);
    const heights = [];
    const r = [];

    for (let i = 0; i < dai; i++) {
        const height = lines[1].split(' ');

        heights[i] = parseInt(height[i], 10);
        r[i] = true;
    }

    for (let i = 0; i < road; i++) {
        const s = lines[i + 2].split(' ');
        const f = parseInt(s[0], 10) - 1;
        const n = parseInt(s[1], 10) - 1;

        if (heights[f] < heights[n]) {
            r[f] = false;
        } else if (heights[f] === heights[n]) {
            r[f] = false;
            r[n] = false;
        }
    }

    console.log(r.filter((val) => {
        return val === true;
    }).length);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));