#include<stdio.h>
int main()
{
    int n,m,i,j,k,a,b,sum=0;
    scanf("%d%d",&n,&m);
    int array[n];
    int h[n];
    memset(h, 0 , sizeof(h));
    for( i = 0; i < n; i++)
    {
         scanf("%d",&array[i]);
    }

    for ( j = 0; j < m; j++)
    {
         scanf("%d%d",&a,&b);
        if(array[a-1]>=array[b-1])
        {
            h[a-1]=1;
        }
        else
        {
             h[b-1]=1;
        }
    }
    for ( k = 0; k < n; k++)
    {
        if(h[k]==1)
        sum++;
    }
    
 printf("%d\n",sum);
    
    


    
    
       
   
}