#include <stdio.h>
#include <stdlib.h>
int main()
{
    int n, m;
    int h[100010];
    int g[100010] = {}; //0 is good
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &h[i]);
    }
    int a, b;
    for (int i = 0; i < m; i++)
    {
        scanf("%d %d", &a, &b);
        a--;
        b--;
        if (h[a] >= h[b])
        {
            g[b] = 1;
        }
        if (h[a] <= h[b])
        {
            g[a] = 1;
        }
    }
    int ans = 0;
    for (int i = 0; i < n; i++)
    {
        if (g[i] == 0)
        {
            ans++;
        }
    }
    printf("%d", ans);
    return 0;
}