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

typedef struct
{
	int A;
	int B;

}integer;


int main()
{
  int N , M;
  scanf("%d %d",&N,&M);
  int H[N+1];
  H[0]=0;

  for (int i =1;i<=N;i++)
  {
  	scanf("%d",&H[i]);
  }

  integer Road[M];
  int Counters[N+1];
  memset(Counters,0,sizeof(Counters[0]) * (N+ 1));

  for (int i = 0;i<M;i++)
  {
  	scanf("%d %d",&Road[i].A,&Road[i].B);
    
  }

   for (int i = 1;i<=N;i++)
   Counters[i]=2;
  
 

  int count = 0;
  for (int i = 0;i<M;i++)
  {
  	if (H[	Road[i].A	] > H[Road[i].B])Counters[Road[i].A]*=1;
    else Counters[Road[i].A]*=0;
  }

  for (int i = 0;i<M;i++)
  {
  	if (H[	Road[i].B	] > H[Road[i].A])Counters[Road[i].B]*=1;
    else Counters[Road[i].B]*=0;
  }
 

  for (int i = 1;i<=N;i++)
  {
   if (Counters[i]==2)
  	count++;
  }

   printf("%d",count);

   return 0;
}
