#include <stdio.h>

int main()
{
  int n,m;
  scanf("%d%d",&n,&m);
  int h[n];
  int a[m],b[m];
  int t[n];
  int i;
  i = 0;
  while (i < n)
  {
    scanf("%d",&h[i]);
    t[i] = 0;
    i++;
  }
  i = 0;
  while (i < m)
  {
    scanf("%d%d",&a[i],&b[i]);
    if (h[a[i] - 1] > h[b[i] - 1])
      t[b[i] - 1] -= 1;
    else if (h[a[i] - 1] < h[b[i] - 1])
      t[a[i] - 1] -= 1;
    else
    {
      t[b[i] - 1] -= 1;
      t[a[i] - 1] -= 1;
    }
    i++;
  }
  i = 0;
  int sum;
  sum = 0;
  while (i < n)
  {
    if (t[i] == 0)
    {
      sum += 1;
    }
    i++;
  }
  printf("%d",sum);
}