"use strict";

const main = (input) => {
    const spi = input.split('\n');
    const [n, m] = spi[0].split(' ').map(e => Number(e));

    const h = spi[1].split(' ').map(e => Number(e));
    const bArray = new Array(n).fill(true);

    for (let i = 2; i < m + 2; i++) {
        const [a ,b] = spi[i].split(' ').map(e => Number(e));
        if (h[a - 1] <= h[b - 1]) bArray[a - 1] = false;
        if (h[b - 1] <= h[a - 1]) bArray[b - 1] = false;
    }

    let ans = 0;
    for (let i = 0; i < n; i++) {
        if (bArray[i]) ans++;
    }
    console.log(ans);
};

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