#include<stdio.h>

int main(){
    int N,K,count=0;
    scanf("%d %d ",&N,&K);
    int h[N],a[K],b[K],q[N];
    for(int i=0;i<N;i++){
        scanf("%d ",&h[i]);
        q[i]=i+1;
    }
    for(int i=0;i<K;i++){
        scanf("%d %d ",&a[i],&b[i]);
    }
    for(int i=0;i<N;i++){
        for(int j=0;j<K;j++){
            if(q[i]==a[j]){
                if(h[a[j]-1] <= h[b[j]-1]){
                    q[i]+=1;
                }
            }else if(q[i]==b[j]){
                if(h[b[j]-1] <= h[a[j]-1]){
                    q[i]+=1;
                }
            }
        }
        if(q[i]!=i+1) count+=1;
    }
    
    printf("%d",count);
    
    return 0;
}