#include<stdio.h>

#define MAX_N 200001
#define max(a,b) ((a) > (b) ? (a):(b))
#define min(a,b) ((a) < (b) ? (a):(b))

int main(void){

  int N,M,A[MAX_N],B[MAX_N],i,j,mem[MAX_N] = {0},ans = 0;
  int ViewTower[MAX_N],big,small,big_n,small_n;

  scanf("%d %d",&N,&M);
  for(i = 1;i <= N;i++){
    scanf("%d",&ViewTower[i]);
  }
  for(i = 1;i <= M;i++){
    scanf("%d %d",&A[i],&B[i]);
  }

  for(i = 1;i <= M;i++){
    if(ViewTower[A[i]] == ViewTower[B[i]]){
      mem[A[i]] = -1;
      mem[B[i]] = -1;
    }else{
      big = max(ViewTower[A[i]],ViewTower[B[i]]);
      small = min(ViewTower[A[i]],ViewTower[B[i]]);

      if(big == ViewTower[A[i]]){
        big_n = A[i];
        small_n = B[i];
      }else{
        big_n = B[i];
        small_n = A[i];
      }
    
      //printf("big:%d small:%d big_n:%d small_n:%d\n",big,small,big_n,small_n);
      if(mem[big_n] >= 0) mem[big_n]++;
      mem[small_n] = -1;
    }
  }

  for(i = 1;i <= N;i++){
    //printf("mem[%d]:%d\n",i,mem[i]);
    if(mem[i] >= 0) ans++;
  }

  printf("%d\n",ans);
  return 0;
}
