function main(input) {
  const lines = input.trim().split("\n");
  const [N, M] = lines.shift().split(' ').map(Number);
  const h = lines.shift().split(' ').map(Number);

  const isGood = Array(N).fill(true);
  lines.forEach(l => {
    const [a, b] = l.split(' ');
    if (h[a-1] > h[b-1])
      isGood[b-1] = false;
    else if (h[a-1] < h[b-1])
      isGood[a-1] = false;
    else {
      isGood[a-1] = false;
      isGood[b-1] = false;
    }
  });
  const res = isGood.filter(g => g).length;
  
  console.log(res);
}

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