#include <stdio.h>

int main(void)
{
  int i, m, n, h[100001], a[100001], b[100001], c[100001] = {0}, result = 0;
  
  scanf("%d %d", &n, &m);

  
  for( i = 0; i < n; i++ ){
      scanf("%d ", &h[i]);
  }
  
  for( i = 0; i < m; i++ ){
      scanf("%d %d", &a[i], &b[i]);
  }
  
  for( i = 0; i < m; i++ ){
    if( h[a[i]-1] > h[b[i]-1] ){
        c[b[i]-1] = 1;
    } else if( h[a[i]-1] < h[b[i]-1] ){
        c[a[i]-1] = 1;
    } else {
        c[a[i]-1] = 1;
        c[b[i]-1] = 1;
    }
  }
  
  for( i = 0; i < n; i++ ){
      if( c[i] == 0 ){
          result++;
      }
  }
  printf("%d\n", result);
  return 0;
}