function Main(input) {
  input = input.trim().split("\n");
  const NM = input[0].split(" ");
  const N = parseInt(NM[0], 10);
  const M = parseInt(NM[1], 10);
  const Hs = input[1].split(" ").map(n=>parseInt(n, 10));
  var A = [];
  var B = [];
for(var i=0;i<M;i++){
    var AB = input[i+2].split(" ");
    A[i] = parseInt(AB[0],10)
    B[i] = parseInt(AB[1],10)
}
t = new Array(N).fill(1);
for (var i=0;i<M;i++){
    if(Hs[A[i]-1]>Hs[B[i]-1]){//BよりAのほうが高い
        t[B[i]-1] = 0
    }else if(Hs[A[i]-1]<Hs[B[i]-1]){
        t[A[i]-1] = 0
    }else{
        t[A[i]-1] = 0
        t[B[i]-1] = 0
    }
}
var ans = t.reduce((a,b)=>a+b,0)
  console.log(ans)

}

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