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

int M;
int N;
int *H;
int *A;
int *B;
int *T;

int main(void)
{
    int c;
    int ans = 0;
    scanf("%d", &N);
    scanf("%d", &M);
    H = (int *)malloc(sizeof(int) * N);
    A = (int *)malloc(sizeof(int) * M);
    B = (int *)malloc(sizeof(int) * M);
    T = (int *)malloc(sizeof(int) * N);
    for (c = 0; c < N; ++c)
    {
        scanf("%d", H + c);
        T[c] = 1;
    }
    for (c = 0; c < M; ++c)
    {
        scanf("%d", A + c);
        scanf("%d", B + c);
        --A[c];
        --B[c];
    }
    for (c = 0; c < M; ++c)
    {
        if (H[A[c]] > H[B[c]])
        {
            T[B[c]] = -1;
        }
        else if (H[A[c]] < H[B[c]])
        {
            T[A[c]] = -1;
        }
        else
        {
            T[A[c]] = 0;
            T[B[c]] = 0;
        }
    }
    for (c = 0; c < N; ++c)
    {
        if (T[c] > 0)
        {
            ++ans;
        }
    }
    printf("%d", ans);
    free(A);
    free(B);
    free(H);
    free(T);
    return 0;
}