#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#include<math.h>
#include<limits.h>
#define MAX 100002
typedef long long ll;
ll N,M;

ll H[MAX];
ll main(){
    scanf("%d %d",&N,&M);
    for(ll i=1;i<=N;i++)
        scanf("%d",H+i);
    bool keep[MAX];
    memset(keep,true,sizeof(keep));
    for(ll i=1;i<=M;i++){
        ll a,b;
        scanf("%d %d",&a,&b);
        if(H[a] > H[b]) keep[b] = false;
        else if(H[a] < H[b]) keep[a] = false;
        else keep[a] = keep[b] = false;
    }
    ll ans=0;
    for(ll i=1;i<=N;i++){
        if(keep[i]) ans++;
    }
    printf("%d",ans);
}
