#include<stdio.h>
int next[300000];
int first[300000];
int go[300000];
int h[300000];
	int n,m,i,ans=0,x,y;
int check(int k){
	int t=first[k];
	int flag=1;
	while (t!=0){
		if (h[go[t]]>=h[k])
		  flag=0;
		t=next[t];
	}
   if (flag==1) return 1;else return 0;
}
int main(){

	scanf("%d %d",&n,&m);
	for (i=1;i<=n;i++)
	  scanf("%d",&h[i]);
	for (i=1;i<=m;i++)
	{scanf("%d %d",&x,&y);
	 next[i]=first[x];
	 first[x]=i;
	 go[i]=y;
	 next[i+m]=first[y];
	 first[y]=i+m;
	 go[i+m]=x;
	}
	for (i=1;i<=n;i++)
	  if (check(i)==1)
	    ans++;
	printf("%d",ans);
}