#include<stdio.h>
struct people
{
	int h;
	int flag;
};
int main()
{
	int n, m,i,sum=0;
	int s,t; //表示正在处理的两个人 
	scanf("%d%d",&n,&m); 
	struct people people[n];
	for (i = 0;i < n;i++)
	{
		scanf("%d",&people[i].h);
		people[i].flag=1;  //是good 
	}
	for(i=0;i<m;i++)
	{
		scanf("%d%d",&s,&t);
		if(people[s-1].h>=people[t-1].h) people[t-1].flag=0;
		if(people[s-1].h<=people[t-1].h) people[s-1].flag=0;
	}
	for(i=0;i<n;i++)
	{
		if(people[i].flag==1) sum++;
	}
	printf("%d",sum);
	return 0;
}