"use strict";
var input = require("fs").readFileSync("/dev/stdin", "utf8");
var cin = input.split(/ |\n/), cid = 0;
function next(a) { return a ? cin[cid++] : +cin[cid++]; }
function nexts(n, a) { return a ? cin.slice(cid, cid += n) : cin.slice(cid, cid += n).map(a => +a); }
function nextm(h, w, a) { var r = [], i = 0; if (a) for (; i < h; i++)r.push(cin.slice(cid, cid += w)); else for (; i < h; i++)r.push(cin.slice(cid, cid += w).map(a => +a)); return r; }
function xArray(v) { var a = arguments, l = a.length, r = "Array(a[" + --l + "]).fill().map(x=>{return " + v + ";})"; while (--l) r = "Array(a[" + l + "]).fill().map(x=>" + r + ")"; return eval(r); }

var myOut = main();
if (myOut !== undefined) console.log(myOut);

function main() {
    //console.log(cin);
    cin = cin.map(i => +i);
    let n = cin.shift();
    let m = cin.shift();
    let h = cin.slice(0, n); cin = cin.slice(n);
    h.unshift(0);
    let a;
    let b;
    let good = Array(n + 1).fill(1);
    good[0] = 0;
    for (let i = 0; i < m; i++) {
        // A.push(cin[2 * i]);
        // B.push(cin[2 * i + 1]);
        a = cin[2 * i];
        b = cin[2 * i + 1];
        if (h[a] >= h[b]) {
            good[b] = 0;
        }
        if (h[b] >= h[a]) {
            good[a] = 0;
        }
    }
    // console.log("n", n);
    // console.log("m", m);
    // console.log("h", h);
    // console.log("A", A);
    // console.log("B", B);
    let ans = 0;
    good.forEach(i => { ans += i; });

    return ans;
}