#include <stdbool.h>
#include <stdio.h>
int h[100000], l[100000][2];
bool isHigher[100000];
int main() {
	int n, m, cnt = 0;
	scanf("%d%d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
		isHigher[i] = true;
	}
	for (int i = 0; i < m; i++) {
		for (int j = 0; j < 2; j++) {
			scanf("%d", &l[i][j]);
		}
		if (h[l[i][0] - 1] < h[l[i][1] - 1]) {
			isHigher[l[i][0] - 1] = false;
		} else if (h[l[i][0] - 1] > h[l[i][1] - 1]) {
			isHigher[l[i][1] - 1] = false;
		} else {
			isHigher[l[i][0] - 1] = isHigher[l[i][1] - 1] = false;
		}
	}
	for (int i = 0; i < n; i++) {
		if (isHigher[i]) {
			cnt++;
		}
	}
	printf("%d\n", cnt);
	return 0;
}