#include <stdio.h>
#include <stdlib.h>
 
typedef long long ll;
typedef struct ways{
    ll A;
    ll B;
}way;

int acmp(const void* left, const void* right){
    if (((way *)left)->A > ((way *)left)->A) return 1;
	else if (((way *)left)->A < ((way *)left)->A) return -1;
	else return 0;
}
 
int main(){
    ll N,M,count,ans;
    ans = 0;
    scanf("%lld %lld",&N,&M);
    ll H[N];
    char flag[N];
    for(ll i = 0;i<N;i++){
        scanf("%lld ",&H[i]);
        flag[i] = 1;
    }
    way w[M];
    for(ll i = 0;i<M;i++) scanf("%lld %lld",&(w[i].A),&(w[i].B));
    qsort(w,M,sizeof(way),acmp);
    for(ll i = 0;i<M;i++){
        if(H[w[i].A-1] < H[w[i].B-1]) flag[w[i].A-1] = 0;
        else if(H[w[i].A-1] > H[w[i].B-1]) flag[w[i].B-1] = 0;
        else {
            flag[w[i].A-1] = 0;
            flag[w[i].B-1] = 0;
        }
    }
    for(ll i = 0;i<N;i++) ans += flag[i];
    printf("%lld\n",ans);
    return 0;
}