#include <stdio.h>
#include<string.h>
#include<stdlib.h>
int main()
{
    int n,m,a,b,count=0,temp;
    scanf("%d %d",&n,&m);
    int h[n+1],good[n+1];
    memset(good,0,(n+1)*sizeof(good[0]));
    for(int i=1;i<=n;i++)
    scanf("%d",&h[i]);
    for(int i=0;i<m;i++)
    {
        scanf("%d %d",&a,&b);
        if(h[a]>h[b]&&good[a]>=0)
        good[a]++;
        if(h[b]>h[a]&&good[b]>=0)
        good[b]++;
        if(good[a]>=0&&h[a]<h[b])
        good[a]=-1;
        if(h[b]>=0&&h[b]<h[a])
        good[b]=-1;
    }
    for(int i=1;i<=n;i++)
    {
        if(good[i]>0)
        count++;
    }
    printf("%d",count);
}
