#include<stdio.h>
int main()
{
int n,m,i,ans;
  ans=0;
  scanf("%d %d",&n,&m);
long int h[n],judge[n];
  for(i=0;i<n;++i)
  {
  scanf("%ld",&h[i]);
    judge[i]=0;
  }
int a[m],b[m];
  for(i=0;i<m;++i)
  {
  scanf("%d %d",&a[i],&b[i]);
   if(h[a[i]-1]>h[b[i]-1]) judge[b[i]-1]++;
   else if(h[a[i]-1]<h[b[i]-1]) judge[a[i]-1]++;
   else if(h[a[i]-1]==h[b[i]-1]) {judge[a[i]-1]++;
                             judge[b[i]-1]++;}
  }
  
  for(i=0;i<n;++i)
  {
  if(judge[i]==0) ans++; 
  }

  printf("%d",ans);
  
return 0;
}