const lines = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n');
const line1st = lines[0].split(' ');
const N = +line1st[0];
const M = +line1st[1];
const H = lines[1].split(' ').map(v => +v);
const A = [];
const B = [];
for (let i = 2; i < 2 + M; i++) {
    const line = lines[i].split(' ');
    A.push(+line[0]);
    B.push(+line[1]);
}

// console.log(`N=${N} M=${M}`);
// console.log(H);
// console.log(A);
// console.log(B);

const badTowers = {};

for (let i = 0; i < M; i++) {
    if (H[A[i]] < H[B[i]]) {
        badTowers[A[i]] = true;
    } else if (H[A[i]] > H[B[i]]) {
        badTowers[B[i]] = true;
    }
}

let good = 0;
for (let i = 1; i <= N; i++) {
    if (!badTowers[i]) {
        good ++;
    }
}

// console.log(badTowers);
console.log(good);
