#include <stdio.h>

int main(){
  int tower_h[100000];
  int tower_good[100000];
  int n,m,count=0;
  int i,a,b;
  
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++){
    scanf("%d",&tower_h[i]);
    tower_good[i]=1;
  }
  
  for(i=0;i<m;i++){
    scanf("%d %d",&a,&b);
    if(tower_h[a-1]<tower_h[b-1]){
      tower_good[a-1]=0;
    } else if(tower_h[b-1]<tower_h[a-1]){
      tower_good[b-1]=0;
    } else {
      tower_good[a-1]=tower_good[b-1]=0;
    }
  }
  
  for(i=0;i<n;i++){
    if(tower_good[i]==1){
      count++;
    }
  }
  printf("%d",count);
}
