#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
typedef struct tagListNode {
  int H;     /* 高さ */
  int flag;	//goodなら1、badなら0
} SKY;

int main(void){
	SKY *S;
	int N,M,A,B;
	int i,ans;
	char str[10000000];
 
	fgets(str, sizeof(str), stdin);
	N=atoi(strtok(str," "));
	M=atoi(strtok(NULL," "));

	S=(SKY*)calloc(N,sizeof(SKY));

	fgets(str, sizeof(str), stdin);
	S[0].H=atoi(strtok(str," "));
	S[0].flag=1;
	for(i=1;i<N;i++){
		S[i].H=atoi(strtok(NULL," "));
		S[i].flag=1;
	}

	for(i=0;i<M;i++){
		fgets(str, sizeof(str), stdin);
		A=atoi(strtok(str," "))-1;
		B=atoi(strtok(NULL," "))-1;
		if(S[A].H <= S[B].H ){
			S[A].flag=0;
		}else{
			S[B].flag=0;
		}
	}

	ans=0;
	for(i=0;i<N;i++){
		if(S[i].flag == 1)ans++;
	}

	printf("%d\n",ans);

	free(S);

	return 0;
}
