#include<stdio.h>

int a[100000];
int b[100000];

int main()
{
	int N,M,num,sum;
	int x,y;
	scanf("%d",&N);
	scanf("%d",&M);
	for(num=0;num<N;num++){
		scanf("%d",&a[num]);
		b[num]=0;
	}
	for(num=0;num<M;num++){
		scanf("%d",&x);
		scanf("%d",&y);
		if(x==y){
			b[x-1]=-1;
			b[y-1]=-1;
		}else if(x>y){
			b[y-1]=-1;
		}else{
			b[x-1]=-1;
		}
	}
	sum=0;
	for(num=0;num<N;num++){
		if(b[num]==0){
			sum++;
		}
	}
	printf("%d",sum);
	return 0;
}