#include <stdio.h>

int main(void){
    int N,M;


    scanf("%d %d",&N,&M);
    int flag[N],l,hight[N],i,j,A,B;
    
    for(l=0;l<N;l++){
        flag[l]=0;
    }

    for(i=0;i<N;i++){
        scanf("%d",&hight[i]);
    }

    for(j=0;j<M;j++){
        scanf("%d %d",&A,&B);
        if(hight[A-1]-hight[B-1]==0){
            flag[A-1]=1;
            flag[B-1]=1;
        }
        else if(hight[A-1]-hight[B-1]>0){
            flag[B-1]=1;
        }
        else{
            flag[A-1]=1;
        }
    }

    int count=0,m;
    for(m=0;m<N;m++){
        if(flag[m]==0){
            count++;
        }
    }

    printf("%d",count);
    return 0;
}