#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include<math.h>
#define ll long long

int main(){
  ll int i,N,M,ANS=0;
  scanf("%lld %lld",&N,&M);
  
  ll int H[N+1];
  ll int A[M+1],B[M+1];
  ll int ans[N+1];
  
  for(i=1;i<=N;i++){
    ans[i]=1;
    scanf("%lld",&H[i]);
  }
  for(i=1;i<=M;i++){
    scanf("%lld %lld",&A[i],&B[i]);
    if(H[A[i]]<=H[B[i]]){
     ans[A[i]]=0;
    }
    if(H[A[i]]>=H[B[i]]){
     ans[B[i]]=0;
    }
  }
  
  for(i=1;i<=N;i++){
    if(ans[i]==1){
      ANS+=1;
    }
  }
  printf("%lld",ANS);
  return 0;
}