function main(input) {
  let [n, m] = input[0].trim().split(" ").map(i => parseInt(i));
  let h = input[1].trim().split(" ").map(i => parseInt(i));

  let base = [];
  for(let i=0;i<n;i++){
    base[i] = true;
  }

  for(i=0;i<m;i++){
    let [a, b] = input[i+2].trim().split(" ").map(i => parseInt(i)-1);
    if(h[a]<h[b]){
      base[a]=false;
    }else if(h[a]===h[b]){
      base[a]=false;
      base[b]=false;
    }else{
      base[b]=false;
    }
  }
  let counter = 0;
  for(let i=0;i<n;i++){
    if(base[i]===true){
      counter++;
    }
  }
  console.log(counter);
}
main(require('fs').readFileSync('/dev/stdin', 'utf8').trim().split("\n"));