#include <stdio.h>

int main(){
  int n, m;  scanf("%d%d", &n, &m);
  long long int h[100002];
  int hisno[100002] = {0};
  for(int i=1; i<=n; i++)  scanf("%lld", &h[i]);

  for(int i=0; i<m; i++){
    int a, b;
    scanf("%d%d", &a, &b);

    if(h[a] > h[b]){
      hisno[b] = 1;
    }else if(h[a] < h[b]){
      hisno[a] = 1;
    }else if(h[a] == h[b]){
      hisno[a] = 1;
      hisno[b] = 1;
    }
  }

  int count = 0;
  for(int i=1; i<=n; i++){
    if(hisno[i] == 0){
      count++;
    }
  }

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

  
  
