#include<stdio.h>
#include<stdlib.h>

int comp(const void *p1,const void *p2);

typedef struct{
	int ti;
	int tj;
} observatories;

int main(void){
	int n,m,i,now,flg,ans;
	int *h;
	observatories*obs;
	scanf("%d%d",&n,&m);
	h=(int *)calloc(n,sizeof(int));
	obs=(observatories *)calloc(2*m,sizeof(observatories));
	for(i=0;i<n;i++) scanf("%d",&h[i]);
	for(i=0;i<m;i++){
		scanf("%d%d",&obs[i].ti,&obs[i].tj);
		obs[m+i].ti=obs[i].tj;
		obs[m+i].tj=obs[i].ti;
	}
	
	qsort(obs,2*m,sizeof(observatories),comp);
	/*
	putchar('\n');
	for(i=0;i<2*m;i++){
		printf("%d %d\n",obs[i].ti,obs[i].tj);
	}*/
	flg=0;
	ans=0;
	i=0;
	
	for(now=1;now<=n;now++){
		//printf("now: %d,ans: %d\n",now,ans);
		for(;obs[i].ti==now && i<2*m;i++){
			//printf("now-1: %d, obs.ti: %d, obs.tj: %d\n",now, obs[i].ti,obs[i].tj);
			if(h[now-1]<=h[obs[i].tj-1]){
				flg=1;
			}
		}
		if(flg==0){
				ans++;
		}
		flg=0;
	}
	printf("%d\n",ans);
	free(obs);
	free(h);
	return 0;
}

int comp(const void *p1,const void *p2){
	const observatories *n1, *n2;
	n1=(const observatories *)p1;
	n2=(const observatories *)p2;
	if(n1->ti==n2->ti){
		return n1->tj-n2->tj;
	}else{
		return n1->ti-n2->ti;
	}
}
