#include <stdio.h>
 
int main()
{
    int n,m;
    scanf("%d %d",&n,&m);
int d;
int height[10001];
for(int i = 0;i<n;i++){
    scanf("%d",&d);
    height[i+1]=d;
}

short route[10001][10001]={{0},{0}};
int a,b;
for(int i = 0;i<m;i++){
    scanf("%d %d",&a,&b);
    route[a][b]=1;
    route[b][a]=1;
}


int point[10001]={0};
long long int sum=0;
for(int i = 1;i<=n;i++){
    for(int j=1;j<=n;j++){
        if(route[i][j]!=0){
            if(height[i]<=height[j]){
                point[i]=1;
            }
        }
    }
}

for(int i=1;i<=n;i++){
    if(point[i]==0){
        sum+=1;
    }
}
printf("%lld",sum);
    return 0;
}