#include <stdio.h>
#include <stdlib.h>
int main(void){
	int n, m;
	long *h;
	int *a;
	int *b;
	int *flgs;
	scanf("%d", &n);
	scanf("%d", &m);
	h = (long *)malloc(sizeof(long) * n);
	flgs = (int *)malloc(sizeof(int) * n);
	a = (int *)malloc(sizeof(int) * m);
	b = (int *)malloc(sizeof(int) * m);
	for(int i=0; i<n; i++){
		scanf("%ld", &h[i]);
		flgs[i] = 1;
	}
	for(int j=0; j<m; j++){
		scanf("%d", &a[j]);
		scanf("%d", &b[j]);
	}
	for(int k=0; k<m; k++){
		int tmp_a = a[k] - 1;
		int tmp_b = b[k] - 1;
		if(h[tmp_a] > h[tmp_b]){
			flgs[tmp_b] = 0;
		}
		else if(h[tmp_a] < h[tmp_b]){
			flgs[tmp_a] = 0;
		}
		else{
			flgs[tmp_a] = 0;
			flgs[tmp_b] = 0;
		}
	}
	int sum = 0;
	for(int l=0; l<n; l++){
		if(flgs[l] == 1){
			sum++;
		}
	}
	printf("%d\n", sum);
	return 0;
}