#include <stdio.h>

int main() {
	int N, M;
	scanf("%d %d", &N, &M);
	int H[100001] = { 0 };
	int T[100001] = { 0 };
	int s;
	for (s = 1; s < N + 1; s++)
		scanf("%lld", &H[s]);
	
	int i = 0;
	for (i = 0; i < M; i++) {
		int a = 0, b = 0;
		scanf("%d %d", &a, &b);
		if (H[a] >= H[b]) {
			T[b] = T[b] + 1;
		}
		if (H[a] <= H[b]) {
			T[a] = T[a] + 1;
		}
	
	}
	int t;
	int sum = 0;
	for (t = 1; t < N + 1; t++) {
		if (T[t] == 0) {
			sum = sum + 1;
		}
	}
	int ans = N - sum;
	printf("%d", sum);
	return 0;
}
