/* C - Peaks */

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

int main(void){
  int N, M, H[10000], A[10000], B[10000], road[10000][10000], peak = 0, i, j, count = 0;
  scanf("%d %d", &N, &M);
  /*
  H = (int*)malloc(sizeof(int) * N);
  A = (int*)malloc(sizeof(int) * M);
  B = (int*)malloc(sizeof(int) * M);
  road = (int**)malloc(sizeof(int*) * N);
  for(i = 0; i < N; i++){
    road[i] = (int*)malloc(sizeof(int) * N);
  }
  */
  for(i = 0; i < N; i++){
    scanf("%d", &H[i]);
  }
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      road[i][j] = 0;
    }
  }
  for(i = 0; i < M; i++){
    scanf("%d %d", &A, &B);
    road[A][B] += 1;
    road[B][A] += 1;
  }
  /*
  for(i = 0; i < N; i++){
    for(j = 0; j < N; j++){
      printf("%d", road[i][j]);
      if(j < N - 1){
        printf(" ");
      }else{
        printf("\n");
      }
    }
  }
  */
  for(i = 0; i < N; i++){
    count = 0;
    for(j = 0; j < N; j++){
      if(road[i][j] > 0 && H[i] <= H[j]){
        count++;
        break;
      }
    }
    if(count == 0){
      peak++;
    }
  }
  printf("%d\n", peak);
}
