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

int main(void){
  int i;
  int ans=0;
  int A,B;
  int *H;
  int *Check;
  int N,M;
  
  scanf("%d %d",&N,&M);
  H = malloc(sizeof(int)*(N+1));
  Check = calloc(sizeof(int),M+1);
  
  for(i=1; i<=N; i++)
    scanf("%d",&H[i]);
  
  for(i=1; i<=M; i++){
    scanf("%d %d",&A,&B);
    if(H[A]<=H[B])
      Check[A]=1;
    if(H[A]>=H[B])
      Check[B]=1;
  }
  
  for(i=1; i<=N; i++)
    if(Check[i]==0)
      ans++;
  printf("%d",ans);
  free(Check);
  free(H);
  return 0;
}
