#include<stdio.h>

int main()
{
	int n, m, k, c, d, i, sum = 0;

	scanf("%d %d", &n, &m);
	int score[n], h[n];
	int a[m], b[m];
	for (i = 0; i < n; i++) {
		scanf("%d", &k);
		h[i] = k;
		score[i] = 1;
	}
	for (i = 0; i < m; i++) {
		scanf("%d%d", &c, &d);
		a[i] = c; b[i] = d;
	}
	for (i = 0; i < m; i++) {
		if (h[a[i]] > h[b[i]])
			score[b[i]] = 0;
		if (h[a[i]] < h[b[i]])
			score[a[i]] = 0;
		if (h[a[i]] == h[b[i]])
			score[a[i]] = 0 ; score[b[i]] = 0;
	}

	for (i = 0; i < n; i++)
		if (score[i] == 1)
			sum++;
	printf("%d", sum);

	return 0;
}