#include<stdio.h>
int main(){
  int a,b,i,n,m,h[100010],c[100010]={};
  scanf("%d %d",&n,&m);
  for(i=0;i<n;i++)scanf("%d",&h[i+1]);
  while(m--){
    scanf("%d %d",&a,&b);
    if(h[a]==h[b])c[b]=c[a]=1;
    if(h[a]>h[b])c[b]=1;
    if(h[a]<h[b])c[a]=1;
  }
  //for(i=0;i<n;i++)printf("%d\n",c[i+1]);
  for(i=a=0;i<n;i++)a+=1-c[i+1];
  printf("%d\n",a);
  return 0;
}
