#include <stdio.h>
#include <stdlib.h>
int main() {
    int N, M, i, A, B, ans = 0;
    scanf("%d %d", &N, &M);
    long *H = malloc(sizeof(long) * N);
    int *count = malloc(sizeof(int) * N);
    /*int *A = malloc(sizeof(int) * M);
    int *B = malloc(sizeof(int) * M);*/
    for (i = 0; i < N; i++) {
        scanf("%ld", H + i);
        count[i] = 0;
    }
    for (i = 0; i < M; i++) {
        scanf("%d %d", &A, &B);
        if (H[A - 1] >= H[B - 1]) count[B - 1]++;
        if (H[A - 1] <= H[B - 1]) count[A - 1]++;
    }
    for (i = 0; i < N; i++)
        if (!count[i]) ans++;
    printf("%d\n", ans);
    return 0;
}