#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>


int main(){

 long long int N,M;
  scanf("%lld %lld",&N,&M);

/*
  char A[];
  scanf("%s",A);
  */

  
  long long int H[N+1];
  int i;
  for(i=1;i<=N;i++){
   scanf("%lld ",&H[i]);
   }
  
  double T[N+1];
    for (i=1;i<=N;i++){
      T[N]=1;
    }
  long long int A,B;
  for(i=1;i<=M;i++){
   scanf("%lld %lld",&A,&B);
   if (H[A] < H[B]){
     if(T[B]!=-1){
     T[A] = -1;
     T[B] = 1;
     }
     else{
     T[A] = -1;
     }
   }
   else if (H[A] > H[B]){
     if(T[A]!=-1){
     T[B] = -1;
     T[A] = 1;
     }
     else{
     T[B] = -1;
     }

   }
   else{
     T[A] = -1;
     T[B] = -1;

   }


   }

long long int counter;
counter = 0;
for (i=1;i<=N;i++){
  if(T[i]>=0){
    counter +=1;
  }
}
printf("%lld",counter);






 return(0);
 }
