#include <stdio.h>

int main()
{
    int n, m, h[100010], check[100010], count = 0;

    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; i++)
        scanf("%d", &h[i]);

    for (int i = 1; i <= m; i++)
    {
        int a, b;
        scanf("%d %d", &a, &b);
        if (h[a] > h[b])
            check[b]++;
        else if (h[a] < h[b])
            check[a]++;
        else
        {
            check[a]++;
            check[b]++;
        }
    }

    for (int i = 1; i <= n; i++)
    {
        if (check[i] == 0)
            count++;
    }
    
    printf("%d", count);
    return 0;
}