#include<stdio.h>
int main()
{
	unsigned long a,b;
	scanf("%lu %lu",&a,&b);
  unsigned long i,H[a],A[b],B[b];
  unsigned long flag[a],l,k1=0;
  unsigned long k2=0;
  unsigned long sum=0;
  unsigned long total=0;
  flag[0]=0;
for(i=0;i<a;i++){
	scanf("%lu",&H[i]);
}
  for(i=0;i<b;i++){
    scanf("%lu %lu",&A[i],&B[i]);
    k1=0;
    k2=0;
    for(l=0;l<sum+1;l++){
      if(flag[l]==A[i]){
        k1=1;
        break;
      }
    }
    for(l=0;l<sum+1;l++){
      if(flag[l]==B[i]){
        k2=1;
        break;
      }
    }
      if(k1==0){
        sum++;
        flag[sum]=A[i];
      }
    if(k2==0){
      sum++;
      flag[sum]=B[i];
    }
  }
  for(i=0;i<sum;i++){
    k1=0;
    for(l=0;l<b;l++){
      if(flag[i]==A[l]){
        if(H[A[l]]<H[B[l]]){
          k1=1;
          break;
        }
      }
      if(flag[i]==B[l]){
        if(H[A[l]]>H[B[l]]){
          k1=1;
          break;
        }
      }
    }
    if(k1==0){
      total++;
    }
  }
  printf("%lu",total);
	return 0;
}