#include <stdio.h>

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

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

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

    for (int j=0;j<n;j++){
        for (int i=0;i<m;i++){
            // printf("h[%d]=%d\n",j,h[j]);
            if (h[j]==c[i])
                h[j]=0;
            if (h[j]==d[i])
                h[j]=0;
            // printf("c[%d]=%d\n",i,c[i]);
            // printf("d[%d]=%d\n",i,d[i]);
            // printf("h[%d]=%d\n",j,h[j]);
        }
    }

    int ans=0;
    for (int j=0;j<n;j++){
        if (h[j]!=0)
        ans=ans+1;
    }

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

    return 0;


}