#include<stdio.h>

int main(void)
{
    int n,m;
    scanf("%d %d",&n,&m);

    long long int h[n];
    for (int i=0;i<n;i++){
        scanf("%lld",&h[i]);
        // printf("%lld\n",h[i]);
    }

    int flag[n];
    for (int i=0;i<n;i++)
        flag[i]=1;

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

    int ans=0;
    for (int i=0;i<n;i++){
        // printf("flag[%d]=%d\n",i,flag[i]);
        if (flag[i]==1)
            ans=ans+1;
    }

    printf("%d\n",ans);


    return 0;
}