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

typedef long long ll;

int h[100008];
int flag[100008];
int a[100008];
int b[100008];

int main(){
  int n,m;
  int i;
  int cnt = 0;

  scanf("%d %d", &n, &m);
  for(i = 1;i <= n;i++){
    scanf("%d", &h[i]);
    flag[i] = 1;
  }

  for(i = 0;i < m;i++){
    scanf("%d %d", &a[i], &b[i]);

    if(h[a[i]] == h[b[i]]) flag[a[i]] = flag[b[i]] = 0;

    else if(h[a[i]] > h[b[i]]) flag[b[i]] = 0;

    else flag[a[i]] = 0;
  }

  for(i = 1;i <= n;i++){
    if(flag[i] == 1) cnt++;
  }

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

  return 0;
}