#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define BUFSIZE 10000000
typedef long long ll;
#define WDSIZE 10000

ll root[WDSIZE][WDSIZE]={0};
ll a_root[BUFSIZE]={0};
ll b_root[BUFSIZE]={0};
int count = 0;
ll mount_high[BUFSIZE]={0};
int N,M;

int cal(int mount_num){
  if(mount_num == N + 1) return 0;
  for(int i = 1;i < N + 1;i++){
       if(root[mount_num][i] == 1 || root[i][mount_num] == 1){
          if(mount_high[i] >= mount_high[mount_num]){
             break;
           }
          }
        if(i == N){

          count++;
        }
    }
    cal(mount_num + 1);
}


int main(void){


  scanf("%d %d",&N,&M);
  for(int i = 1;i <= N;i++){
    scanf("%lld",&mount_high[i]);
    }

  for(int i = 0;i < M; i++){
      scanf("%lld",&a_root[i]);
      scanf("%lld",&b_root[i]);
      root[a_root[i]][b_root[i]] = 1;

    }

    cal(1);
    printf("%d",count);

}
