#include <stdio.h>

int main(void){

  long n,m;
  scanf("%ld %ld", &n, &m);
  long h[n];
  for (long i = 0; i < n; i++) {
    scanf("%ld", &h[i]);
  }
  long a[m],b[m];
  for (long i = 0; i < m; i++) {
    scanf("%ld %ld", &a[i], &b[i]);
  }
  int check[n];
  for (long i = 0; i < n; i++) {
    check[i] = 1;
  }
  for (long i = 0; i < m; i++) {
    if (h[a[i]-1] >= h[b[i]-1]) {
      check[b[i]-1] = 0;
    }
    if (h[a[i]-1] <= h[b[i]-1]) {
      check[a[i]-1] = 0;
    }
  }
  long count = 0;
  for (long i = 0; i < n; i++) {
    if (check[i] == 1) {
      count++;
    }
  }
  printf("%ld\n", count);

  return 0;
}