#include <stdio.h>
int main(void){
    int n,m,x,y,i,cnt=0;
    scanf("%d%d",&n,&m);
    int a[n],h[n];
    for(i=0;i<n;i++){
        scanf("%d",&h[i]);
        a[i]=0;
    }
    for(i=0;i<m;i++){
        scanf("%d%d",&x,&y);
        if(h[x-1]>=h[y-1]) a[y-1]=1;
        if(h[x-1]<=h[y-1]) a[x-1]=1;
    }
    for(i=0;i<n;i++){
        if(a[i]==0) cnt++;
    }
    printf("%d",cnt);
    return 0;
}