#include<stdio.h>
int larger(int a,int b){
 if(a<b)return b;
 else   return a;
}

int main(){
 long long  n,m;
 scanf("%lld%lld",&n,&m);
 long long  h[n],a[m],b[m];
 long long i;
 for(i=0;i<n;i++)
  scanf("%lld",&h[i]);
 
 for(i=0;i<n;i++)
  scanf("%lld%lld",&a[i],&b[i]);
  
 long long  cnt[n],tmp[n],x;
 for(i=0;i<n;i++){
  cnt[i]=0;tmp[i]=0;}
  
 for(i=0;i<m;i++){
  cnt[a[i]-1]++;cnt[b[i]-1]++;
  if(h[a[i]-1]>h[b[i]-1])tmp[a[i]-1]++;
  if(h[a[i]-1]<h[b[i]-1])tmp[b[i]-1]++;
 }
 
 long long ans=0;
 for(i=0;i<n;i++){
 // printf("%lld %lld %lld\n",i+1,cnt[i],tmp[i]);
  if(cnt[i]==tmp[i])ans++;}
  
 printf("%lld\n",ans);
  
return 0;}