#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    intmax_t N, M, H[(int)1e5], A[(int)1e5], B[(int)1e5];
    intmax_t good[(int)1e5], ans = 0;

    scanf("%jd%jd", &N, &M);
    for (size_t i = 0; i < N; i++) {
        scanf("%jd", &H[i]);
        good[i] = true;
    }
    for (size_t i = 0; i < M; i++) {
        scanf("%jd%jd", &A[i], &B[i]);
    }

    for (size_t i = 0; i < M; i++) {
        if (H[A[i] - 1] < H[B[i] - 1])
            good[A[i] - 1] = false;
        else if (H[A[i] - 1] == H[B[i] - 1])
            good[A[i] - 1] = good[B[i] - 1] = false;
        else
            good[B[i] - 1] = false;
    }

    for (size_t i = 0; i < N; i++) {
        if (good[i])
            ans++;
    }

    printf("%jd\n", ans);

    return 0;
}
