#include<stdio.h>

int N, M;
int Height[100010];
int AnsTower[100010];

int A, B;

int answer = 0;

int main(void){

    for(int index=0; index<100010; index++){
        AnsTower[index] = 1;
    }

    scanf("%d%d", &N, &M);

    for(int index=0; index<N; index++){
        scanf("%d", &Height[index]);
    }

    for(int i=0; i<M; i++){

        scanf("%d%d", &A, &B);
        if(Height[A-1] > Height[B-1]){
            AnsTower[B-1] = 0;
        }else if(Height[A-1] < Height[B-1]){
            AnsTower[A-1] = 0;
        }else{
            AnsTower[A-1] = 0;
            AnsTower[B-1] = 0;
        }

    }

    for(int index=0; index<N; index++){
        answer += AnsTower[index];
        //printf("%d:%d\n", index, AnsTower[index]);
    }

    printf("%d\n", answer);

    return 0;
} 