#include <stdio.h>

typedef long long ll;

int main(void) {
  
  int n, m;
  scanf("%d %d", &n, &m);
  ll H[n+1];
  int data[n+1];
  for(int i = 1;i <= n;i++) {
    scanf("%lld", H + i);
    data[i] = 0;
  }
  for(int i = 0;i < m;i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    int c = H[a] - H[b] > 0 ? b : a;
    data[c]++;
    if(H[a] == H[b]) data[c == a ? b : a]++;
  }
  int ret = 0;
  for(int i = 1;i <= n;i++) {
    if(data[i] == 0) ret++;
  }
  printf("%d\n", ret);
  
  return 0;
}