#include<stdio.h>


int main(void){
  int n,m,h[100000],a[100000],b[100000];
  int i,j,c=0,x[100000];
  scanf("%d %d",&n,&m);
  for(i=1;i<=n;i++){
    scanf("%d",&h[i]);
    x[i]=1;
  }

  for(i=1;i<=m;i++){
    scanf("%d %d",&a[i],&b[i]);
    if(h[a[i]]==h[b[i]]){
      x[a[i]]=0;
      x[b[i]]=0;
    }

    if(h[a[i]]>h[b[i]]){
      x[b[i]]=0;
    }

    if(h[a[i]]<h[b[i]]){
      x[a[i]]=0;
    }
  }

  for(i=1;i<=n;i++){
    if(x[i]==1){
      c++;
    }
  }
  printf("%d\n",c);
  return 0;
}