#include<stdio.h>

int main(void){
  int n,m,i,ai,bi,sum;
  int a[100000][2];
  sum = 0;
  scanf("%d %d", &n, &m);
  for(i=0;i<n;i++){
    scanf("%d", &a[i][0]);
    a[i][1] = 0;
  }
  for(i=0;i<m;i++){
    scanf("%d %d", &ai, &bi);
    if(a[ai-1][0] > a[bi-1][0])
      a[bi-1][1] = 1;
    else if(a[ai-1][0] == a[bi-1][0]){
      a[ai-1][1] = 1;
      a[bi-1][1] = 1;
    }else
      a[ai-1][1] = 1;
  }
  for(i=0;i<n;i++){
    if(a[i][1] == 0)
      sum++;
  }
  printf("%d", sum);
  return 0;
}