#include <stdio.h>

int main(void){
	int n,m,i,answer=0;
	scanf("%d %d",&n,&m);
	int h[n];//高さ格納
	int way[n][n]; //道(元+行先)格納
	for(i=0;i<n;i++){//way初期化
		int j;
		for(j=0;j<n;j++){
			way[i][j] = 0;
		}
	}
	for(i=0;i<n;i++){
		scanf("%d",&h[i]);
	}
	for(i=0;i<m;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		way[a][b] = 1;
		way[b][a] = 1;
	}
	for(i=0;i<n;i++){
		int j;
		int count=0,high=0;
		for(j=0;j<n;j++){
			if(way[i][j] == 1){
				count++;
				if(h[i] < h[j]){
					high++;
				}
			}
		}
		if(count == 0 || high == 0){
			answer++;
		}
	}
	printf("%d\n",answer);
  return 0;
}