#include <stdio.h>
#include <math.h>
#include <stdint.h>
int main(void)
{
    int is_good[100001];
    for (int64_t i = 0; i < 100001; i++)
    {
        is_good[i] = 1;
    }
    int64_t N, M;
    scanf("%lli %lli", &N, &M);
    int64_t height[100000];
    for (int64_t i = 1; i <= N; i++)
    {
        scanf("%lli", &height[i]);
    }
    for (int64_t i = 1; i <= M; i++)
    {
        int64_t A, B;
        scanf("%lli %lli", &A, &B);
        if (height[A] >= height[B])
        {
            is_good[B] = 0;
        }
        if (height[A] <= height[B])
        {
            is_good[A] = 0;
        }
    }
    int64_t sum = 0;
    for (int64_t i = 1; i <= N; i++)
    {
        if (is_good[i])
        {
            sum++;
        }
    }
    printf("%lli\n", sum);
    return 0;
}