#include <stdio.h>

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

    int x = 0;
    for (int i = 0; i < N; i++) {
        int j = 0;
        while (j < M) {
            if (A[j] - 1 == i && H[i] <= H[B[j]-1]) {
                break;
            } else if (B[j] - 1 == i && H[i] <= H[A[j]-1]) {
                break;
            }
            j++;
        }
        if (j == M) {
            x++;
        }
    }
    
    printf("%d\n", x);
    return 0;
}