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

typedef struct
{
	int A;
	int B;

}integer;

int cmpfunc(const void *a , const void *b)
{
	integer *orderA = (integer *)a;
	integer *orderB = (integer *)b;

	return (orderA->A - orderB->A);
}



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];

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

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

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

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

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

  printf("%d",count);
   return 0;
}
