#include<stdio.h>
#include<stdlib.h> 
#include<string.h>
inline int read(){
    int s = 0, w = 1; char ch = getchar();
    while(ch < '0' || ch > '9'){ if(ch == '-') w = -1; ch = getchar();}
    while(ch >= '0' && ch <= '9') s = s * 10 + ch - '0', ch = getchar();
    return s * w;
}
int main(){
	int on,rm,i,j,h[10000],kick[10000]={},count=0,conj1,conj2,good;
	on=read();
	rm=read();
	for(i=1;i<=on;i++)
	{
		h[i]=read();
	}
	for(i=1;i<=rm;i++){
		conj1=read();
		conj2=read();
		if(h[conj1]>h[conj2]) kick[conj2]=1;
		else if(h[conj1]<h[conj2]) kick[conj1]=1;
		else { kick[conj1]=1;	kick[conj2]=1;	}
	}
	
	for(i=1;i<=on;i++)
	{
		if(!kick[i]){count++;}
	}
	printf("%d",count);
	
	return 0;
}