#include <stdio.h>

int main(void)
{
  int n,m;
  int a,b;
  int h[1000000];
  int count[1000000];
  int good[1000000];
  int sum=0;
  scanf("%d %d", &n, &m);
  for(int i=1;i<=n;i++){
    scanf("%d", &h[i]);
  }
  for(int i=1;i<=m;i++){
    scanf("%d %d", &a, &b);
    count[a] += 1;
    count[b] += 1;
    if(h[a] > h[b]){
      good[a] += 1;
    } else if(h[b] > h[a]){
      good[b] += 1;
    }
  }
  for(int i=1;i<=n;i++){
    if(count[i] == good[i]){
      sum += 1;
    }
  }
  printf("%d\n", sum);
  return 0;
}
