#include<stdio.h>
int main(void){
	int N,M,i,j,Aj,Bj,a=0;
	scanf("%d %d",&N,&M);
	int H[N],P[N];
	for(i=0;i<N;i++){
		scanf("%d",&H[i]);
		P[i]=0;
	}
	for(j=0;j<M;j++){
		scanf("%d %d",&Aj,&Bj);
		if(H[Aj-1]>=H[Bj-1]){
			P[Bj-1]=P[Bj-1]+1;
		}
		if(H[Aj-1]<=H[Bj-1]){
			P[Aj-1]=P[Aj-1]+1;
		}
	}
	for(i=0;i<N;i++){
		if(P[i]==0){
			a=a+1;
		}
	}
	printf("%d\n",a);
	return 0;
}
