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

int main(){
  int N, M;
  scanf("%d %d", &N, &M);
  long int *H; 
  int *D;
  H = (long int *)malloc(sizeof(long int) * N);
  D = (int *)malloc(sizeof(int) * N);
  for(int i = 0; i < N; i++){
    scanf("%ld", &H[i]);
    D[i] = 0;
  }
  int A, B;
  for(int i = 0; i < M; i++){
    scanf("%d %d", &A, &B);
    if(H[A - 1] > H[B - 1]) {
      if(D[A - 1] == 0) D[A - 1] = 1;
      D[B - 1] = -1;
    }
    else if(H[A - 1] < H[B - 1]) {
      D[A - 1] = -1;
      if(D[B - 1] == 0) D[B - 1] = 1;
    }
    else {
      D[A - 1] = -1;
      D[B - 1] = -1;
    }
  }
  int ans = 0;
  for(int i = 0; i < N; i++){
    if(D[i] != -1) ans++;
  }
  printf("%d", ans);
  free(H);
  free(D);
  return 0;
}