//C
#include<stdio.h>
int main(void){
  int N,M;
  int i;
  int ans=0;
  int a,b;
  scanf("%d%d",&N,&M);
  int Takasa[N];
  int Hikui[N];
  for(i=1;i<=N;i++){
    scanf("%d",&Takasa[i]);
    Hikui[i]=0;
  }
  for(i=1;i<=M;i++){
    scanf("%d%d",&a,&b);
    if(Takasa[a]>=Takasa[b]){
      Hikui[b]=-1;
    }
    if(Takasa[b]>=Takasa[a]){
      Hikui[a]=-1;
    }
  }
  for(i=1;i<=N;i++){
    if(Hikui[i]!=0){
      ans=ans+1;
    }
  }
  printf("%d",ans);
  return 0;
}