/* atcoder 166_C */

#include<stdio.h>

int main(void){

    int N,M,i;
    printf("N M\n");
    scanf("%d %d",&N,&M);

    int H[N];
    printf("H\n");
    for(i=0;i<N;i++){
        scanf("%d",&H[i]);
    }
    printf("\n");

    int A[M],B[M];
    printf("A B\n");
    for(i=0;i<M;i++){
        scanf("%d %d",&A[i],&B[i]);
    }

    int count[M+1];
    int ans=0;
    
    for(i=0;i<M;i++){
        if(H[A[i]] < H[B[i]]){
            count[B[i]] = 1;
        }
        else{
            count[A[i]] = 1;
        }
    }

    for(i=1;i<=N;i++){
        if(count[i] == 1){
            ans++;
        }
    }
    /*printf("1:%d 2:%d 3:%d 4:%d\n",count[1],count[2],count[3],count[4]);*/

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