#include<stdio.h>
int main()
{
	int a,b,c=0,i;
	int x[100000],y[100000],z[100000],w[100000]={0};
	scanf("%d %d",&a,&b);
	for(i=1;i<=a;i++){
		scanf("%d",&x[i]);
	}
	for(i=1;i<=b;i++){
		scanf("%d %d",&y[i],&z[i]);
		if(x[y[i]]==x[z[i]]){
			w[y[i]]++;
			w[z[i]]++;
		}
		else if(x[y[i]]<x[z[i]]){
			w[y[i]]++;
		}
		else w[z[i]]++;
	}
	for(i=1;i<=a;i++){
		if(w[i]==0){
			c++;
		}
	}
	printf("%d\n",c);
	return 0;
}