#include <stdio.h>

int main(){
  	int ans = 0;
  	int i, j;
  	int N, M;
  	int A, B;
  	int NextNum;
  	int High[100000];
  	int Road[100000][2];
  	int NextTower[100000];
  	int BadTower[100000];
  
  	scanf("%d%d", &N, &M);
  	//input - High
  	for(i=0;i<N;i++){
      scanf("%d", &High[i]);
    }
  	//input - Road
  	for(j=0;j<M;j++){
    	scanf("%d%d", &Road[j][0], &Road[j][1]);
    }
  
  	//init
  	for(i=0;i<N;i++){
    	BadTower[100000] = 0;
    }
  	
  	//check
  	for(i=0;i<N;i++){
      if(BadTower[i] == 1){
         continue;
      }
      for(j=0;j<N;j++){
        NextTower[j] = 0;
      }
      NextNum = 0;
      for(j=0;j<M;j++){
        A = Road[j][0]-1;
        B = Road[j][1]-1;
       if(A == i){
          	NextTower[NextNum++] = B;
          	if(High[B] >= High[i]){
              break;
            }
        }else if(B == i){
          	NextTower[NextNum++] = A;
        	if(High[A] >= High[i]){
              break;
            }
        }else{
        	//This tower has no next tower.
        }
      }
      if(j==M){
        ans++;
        for(j=0;j<NextNum;j++){
        	BadTower[NextTower[j]] = 1;
        }
      }
    }
  
  	printf("%d\n", ans);
  	
	return 0;
}