#include <stdio.h>
int main()
{
    int n,m;
    scanf ("%d %d\n",&n,&m);
    int *arr = (int *)calloc (n+1,sizeof (int));
    
    int ht[n+1];
    
    for (int i=1;i<n+1;i++)
    {
        scanf("%d ",ht+i);
    }
    
    for (int i=0 ; i<m ; i++)
    {
        int a1,a2;
        scanf ("%d %d\n",&a1,&a2);
        
        if (ht[a1] < ht[a2])
        {
            arr[a1] = -1;
            if (arr[a2] == -1);
            else arr[a2] = 1;
        }
        else if (ht[a1] > ht[a2])
        {
            arr[a2] = -1;
            if (arr[a1] == -1);
            else arr[a1] = 1;
        }
        else
        {
            arr[a1] = -1;
            arr[a2] = -1;
        }
        
    }
    
    int cnt = 0;
    for (int i=1;i<n+1;i++)
    {
        if (arr[i] != -1) cnt++;
    }
    printf("%d\n",cnt);
} 