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

int main (){

  int N = 0, M = 0;
  scanf("%d %d", &N, &M);

  int H[N], A[M], B[M];
  int i = 0;
  for( i = 0; i < N; i++ ){
    scanf("%d", &H[i]);
  }
  for( i = 0; i < M; i++ ){
    scanf("%d %d", &A[i], &B[i]);
  }

  int check[N];
  for( i = 0; i < N; i++ ){
    check[i] = 1;
  }

  for( i = 0; i < M; i++ ){
    if( H[A[i] - 1] < H[B[i] - 1] ){
      check[A[i] - 1] = 0;
    }
    else if( H[A[i] - 1] > H[B[i] - 1] ){
      check[B[i] - 1] = 0;
    }
    else if( H[A[i] - 1] == H[B[i] - 1] ){
      check[A[i] - 1] = 0;
      check[B[i] - 1] = 0;
    }
  }

  int res = 0;
  for( i = 0; i < N; i++ ){
    res = res + check[i];
  }

  printf("%d \n", res);

  return 0;
}