#include <stdio.h>
#include <stdlib.h>

int main()
{
	int i, j, ret;
	int N, M;
	int *H;
	int *OK;
	int *A;
	int *B;
	int count;
	int NGhit;
	ret = scanf("%d %d", &N, &M);

	H = (int *) malloc(sizeof(int)*N);
	OK = (int *) malloc(sizeof(int)*N);
	for (i = 0; i < N; i++)
		OK[i] = 1;
	
	for (i = 0; i < N; i++) {
		ret = scanf(" %d", &H[i]);
		// fprintf(stderr, "%d ", H[i]);
		
	}
	// fprintf(stderr, "\n");
	
	A = (int *) malloc(sizeof(int)*M);
	B = (int *) malloc(sizeof(int)*M);
	
	for (i = 0; i < M; i++) {
		ret = scanf(" %d %d\n", &A[i], &B[i]);
		// fprintf(stderr, "%d %d\n", A[i], B[i]);
	}

	for (i = 0; i < N; i++) {
		NGhit = 0;
		/* if i is good */
		for (j = 0; j < M; j++) {
			if (A[j]-1 == i) {
				if (H[B[j]-1] >= H[i]) {
					NGhit = 1;
					break;
				}
			} else if (B[j]-1 == i) {
				if (H[A[j]-1] >= H[i]) {
					NGhit = 1;
					break;
				}
			}
		}
		if (NGhit == 1)
			OK[i] = 0;
	}

	count = 0;
	for (i = 0;i < N; i++) {
		if (OK[i] == 1) {
			count++;
			// fprintf(stderr, "i: %d \n", i);
		}
	}
	printf("%d\n",count);
	fflush(stdout);
	free(H);
	free(OK);
	free(A);
	free(B);
	return EXIT_SUCCESS;
}
