#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	long int i, j;
	long int n, m;
	long int h[100000];
	long int a[100000];
	long int b[100000];
	long int count[100000] = {0};
	long int work;
	long int flg = 0;
	long int ans = 0;
	
	scanf("%ld %ld", &n, &m);
	
	for(i = 0; i < n; i++) {
		scanf("%ld", &h[i]);
	}
	
	for(i = 0; i < m; i++) {
		scanf("%ld %ld", &a[i], &b[i]);
		if(h[a[i] - 1] <= h[b[i] - 1]) {
			count[a[i] - 1]++;
		}
		if(h[a[i] - 1] >= h[b[i] - 1]) {
			count[b[i] - 1]++;
		}
	}
	
	for(i = 0; i < n; i++) {
		if(count[i] == 0) {
			ans++;
		}
	}
	
	printf("%ld\n", ans);
	
	return 0;
}
