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

struct peak {
  long long int h;
  int flag;
};

int main(void) {
  long long int n, m;
  scanf("%lld %lld", &n, &m);
  struct peak peak[n];
  for (long long int i = 0; i < n; i++) {
    long long int tmp_h;
    scanf(" %lld", &tmp_h);
    peak[i].h = tmp_h;
    peak[i].flag = 1;
  }

  for (long long int i = 0; i < m; i++) {
    long long int a, b;
    scanf(" %lld %lld", &a, &b);
    if (peak[a - 1].h > peak[b - 1].h) peak[b - 1].flag = 0;
    else if (peak[a - 1].h < peak[b - 1].h) peak[a - 1].flag = 0;
    else {
      peak[b - 1].flag = 0;
      peak[a - 1].flag = 0;
    }
  }

  long long int sum = 0;
  for (long long int i = 0; i < n; i++) {
    if (peak[i].flag) sum++;
  }
  printf("%lld\n", sum);

  return 0;
}
