#include<stdio.h>

int main(void)
{
  long n,m;
  long long h[200000];
  long a[200000];
  long b[200000];
  int flag[200000]={0};
  long count=0L;


  scanf("%ld %ld",&n,&m);

  for(long i=1;i<=n;i++){
    scanf("%lld",&h[i]);
  }


  for(long i=1;i<=m;i++){
    scanf("%ld %ld",&a[i],&b[i]);
  }


  for(int i=1;i<=m;i++){
    if(h[a[i]]>h[b[i]]){
      flag[b[i]]=1;
      flag[a[i]]=0;
    }else if(h[a[i]]<h[b[i]]){
      flag[a[i]]=1;
      flag[b[i]]=0;
    }else{
      flag[a[i]]=1;
      flag[b[i]]=1;
    }
  }


  for(long i=1;i<=n;i++){
    if(flag[i]==0){
      count++;
    }
  }


  printf("%ld\n",count);

  return 0;
}
