#include<stdio.h>

int main(void){
  int n , m;
  scanf("%d %d",&n ,&m);

  int h[n+2];
  for(int i = 1;i <= n;i ++){
    scanf("%d",&h[i]);
  }

  int check[100002] = {0};
  int a[m] , b[m];
  for(int i = 0;i < m;i ++){
    scanf("%d %d",&a[i] ,&b[i]);
    if(h[a[i]] > h[b[i]]){
      check[b[i]] = 1;
    }
    else if(h[a[i]] < h[b[i]]){
      check[a[i]] = 1;
    }
    else{
      check[a[i]] = 1;
      check[b[i]] = 1;
    }
  }
  
  int ans = 0;
  for(int i = 1;i <= n;i ++){
  	if(check[i] == 0){
      ans ++;
    }
  }

  printf("%d\n",ans);

  return 0;

}