#include<stdio.h>
int main()
{
int i;
int j;
int N;
int M;
int di;
int dj;
int takasa[100100];
int win[100100];
int count=0;

scanf("%d %d",&N,&M);

for(i=1;i<N+1;i++){win[i]=1;}
for(i=1;i<N+1;i++){
scanf("%d ",&takasa[i]);
}

for(i=1;i<M+1;i++){
scanf("%d ",di);
scanf("%d ",dj);
if(takasa[di]>takasa[dj]){
win[dj]=0;
}else{win[di]=0;}

}

for(i=1;i<N+1;i++){
IF(win[i]==0){count++;}
}

printf("%d",count);

return 0;
}
