#include<stdio.h>
int main(){
	int n,m,a,b,i,ans;
	scanf("%d %d",&n,&m);
	int h[n+1],count[n+1];
	for(i=1;i<=n;i++){
	scanf("%d",&h[i]);
	count[i]=1;
	}
	for(i=1;i<=m;i++){
		scanf("%d %d",&a,&b);
		if(h[a]>=h[b]){
			count[b]=0;
		}
		if(h[a]<=h[b])
		count[a]=0;
    }
	for(int i=1;i<=n;i++){
		if(count[i]==1)
		ans++;
	}
	printf("%d",ans);
}
