#include<stdio.h>
#define REP(i,n) for (int i = 0 ; i < (int)n ; i++)
typedef long long ll;

int main(){
    int n,m;
    int count = 0;
    int flag = 0;
    scanf("%d %d",&n,&m);
    int ten_h[n];
    int nice[n];
    int load[m][2];
    
    REP(i,n){
        scanf("%d",&ten_h[i]);
        nice[i] = 0;
    }
    REP(i,m){
        scanf("%d %d",&load[i][0],&load[i][1]);
    }

    REP(i,m){
        if (ten_h[load[i][0]] > ten_h[load[i][1]]){
            nice[load[i][0]-1] = 1;
        }else if( ten_h[load[i][0]] < ten_h[load[i][1]] ){
            nice[load[i][1]-1] = 1;
        }
    }
    REP(i,n){
        if( nice[i] == 1 ){
            count += 1;
        }
    }
    printf("%d\n",count);

}