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

int main(void){

    int N = 0;
    int M = 0;
    int count = 0;
    scanf("%d %d", &N, &M);

    int H[N];
    char check[N][4];
    int A = 0;
    int B = 0;
    for (int i = 0; i < N; i++){
        scanf("%d", &H[i]);
    }
    for (int j = 0; j < M; j++){
        scanf("%d %d", &A, &B);
        if (H[A - 1] < H[B - 1]){
            strcpy(check[A - 1],"bad");
        } else {
            strcpy(check[B - 1],"bad");
        }
    }
    for (int k = 0; k < N; k++){
        if (strcmp(check[k], "bad") != 0){
            count++;
        }
    }
    printf("%d\n", count);

    return 0;
}