#include<stdio.h>
#include<string.h>

int main(void){

    int N,M;
    int i,j;
    int H[128];
    int A[128][128];
    int add;
    int count = 0;
    int num;

    if(scanf("%d%d",&N,&M) != 2) return 1;
    for(i=0;i<N;i++){
        if(scanf("%d",&H[i]) != 1) return 1;
    }
    for(i=0;i<M;i++){
        for(j=0;j<2;j++){
            if(scanf("%d",&A[i][j]) != 1) return 1;
        }
    }
    int tmp[N][M+1];
    for(i=1;i<=N;i++){
        tmp[i-1][0] = i;
        for(j=0;j<M;j++){
            if(A[j][0] == i){
                tmp[i-1][j+1] = A[j][1];
            }else if(A[j][1] == i){
                tmp[i-1][j+1] = A[j][0];
            }else{
                tmp[i-1][j+1] = 0;
            }
        }
    }

    for(i=0;i<N;i++){
        num = 0;
        for(j=1;j<M+1;j++){
            if(H[tmp[i][0]-1] > H[tmp[i][j]-1]) num++;
        }
        if(num >= M) count++;
    }

    printf("%d",count);

    return 0;
}