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

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