#include <stdio.h>

int main(void)
{
  long n, m;

  scanf("%ld%ld", &n, &m);

  long long h[n];

  for (long i = 0; i < n; i++)
    scanf("%lld", &h[i]);

  long ab[m][2];

  for (long i = 0; i < m; i++)
    for (long j = 0; j < 2; j++)
      scanf("%ld", &ab[i][j]);

  /*M本の道に従って計算*/
  long ans = 0, hh[n]; /* <- pear よりlow なら++*/
  for (long i = 0; i < n; i++)
    hh[i] = 0;

  for (long i = 0; i < m; i++) {
    if (h[ab[i][0]-1] >  h[ab[i][1]-1]) hh[ab[i][1]-1]++;
    else if(h[ab[i][0]-1] < h[ab[i][1]-1])  hh[ab[i][0]-1]++;
    else {hh[ab[i][1]-1] = hh[ab[i][0]-1] = 1;}
  }

  for (long i = 0; i < n; i++)
    if (hh[i] == 0) ans++;
    
  printf("%ld\n", ans);

  return 0;
}


