#include <stdio.h>

#include<string.h>

int main()
{ long int sum = 0;
  long int N;
  long int M;
  int flag = 1;
  scanf("%ld %ld\n",&N,&M);
  long int H[N];
  for(long int i=0;i<N;i++){
      scanf("%ld ",&H[i]);
      
  }
  long int R[M][2];
  scanf("\n");
  for(long int i=0;i<N;i++){
      scanf("%ld %ld\n",&R[i][0],&R[i][1]);
  }
  for(long int j=0;j<N;j++ ){
      flag = 1;
      for(long int k=0;k<M;k++){
          if(R[k][0]==(j+1)||R[k][1]==(j+1)){
              flag = 0;
              break;
          }
      }
      if(flag==1){
          sum = sum +1;
          continue;
      }
  }
  for(long int j=0;j<N;j++){
      int yo = 1;
      for(long int k=0;k<M;k++){
          if(R[k][0]==(j+1)){
              if(H[j]>H[(R[k][1])])
              continue;
              else{
                  yo = 0;
                  break;
              }
          }
          if(R[k][1]==(j+1)){
              if(H[j]>H[(R[k][0])])
              continue;
              else{
                  yo = 0;
                  break;
              }
          }
          
      }
      if(yo==1){
          sum = sum + 1;
          continue;
      }
      
  }
  printf("%ld",sum);
}