#include<stdio.h>

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

        for(i=0; i<n; i++){
                if(counter[i]==0){
                        count++;
                }
        }
        printf("%d", count);

        return 0;
}
