#include <stdio.h>
#include <string.h>

int main(void) {
  int n = 0, m = 0;
  int i, j;
  int height[100000];
  int is_good[100000];
  
  scanf("%d %d", &n, &m);
  for(i = 0; i < n; i++) {
    is_good[i] = 1;
  }
  for(i = 0; i < n; i++) {
    scanf("%d", &height[i]);
  }
  
  for(i = 0; i < m; i++) {
    int path_a = 0, path_b = 0;
    scanf("%d %d", &path_a, &path_b);
    path_a--;
    path_b--;
    if(height[path_a] <= height[path_b]) {
      is_good[path_a] = 0;
    }
    if(height[path_a] >= height[path_b]) {
      is_good[path_b] = 0;
    }
    
    /*
    for(j = 0; j < n; j++) {
      printf("%d ", is_good[j]);
    }
    printf("\n");
    */
  }
  
  int number_of_good = 0;
  
  for(i = 0; i < n; i++) {
//    printf("%d ", is_good[i]);
    if(is_good[i] == 1) number_of_good++;
  }
//  printf("\n");
  
  printf("%d\n", number_of_good);
  
  return 0;
}