#include <stdio.h>
#define GOOD 1
#define BAD 0

int main(void){
    int n,m,h[100000],a,b;
    int i,x[100000],ans=0;
    scanf("%d %d",&n,&m);
    for(i=1;i<=n;i++){
        scanf("%d",&h[i]);
        x[i] = GOOD;
    }

    for(i=1;i<=m;i++){
        scanf("%d %d",&a,&b);
        if(h[a] == h[b]){
            x[a] = BAD;
            x[b] = BAD;
        } 
        if(h[a] > h[b]) x[b] = BAD;
        if(h[a] < h[b]) x[a] = BAD;
    }

    for(i=1;i<=n;i++){
        if(x[i] == GOOD) ans++;
    }

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

    return 0;
}