#include <stdio.h>

int main(){
  int n,m,i,temp,temp2,ans=0;
  scanf("%d %d",&n,&m);
  int high[n];
  int flag[n];
  for(i=0;i<n;i++){
    scanf("%d",&temp);
    high[i]=temp;
    flag[i]=0;
  }
  for(i=0;i<m;i++){
    scanf("%d %d",&temp,&temp2);
    if(high[temp-1]>high[temp2-1]){
      flag[temp2-1]++;
    }else if(high[temp-1]<high[temp2-1]){
      flag[temp-1]++;
    }else{
      flag[temp-1]++;
      flag[temp2-1]++;
    }
  }
  for(i=0;i<n;i++){
    if(flag[i]==0){
      ans++;
    }
  }
  printf("%d\n",ans);
  return 0;  
}  