#include <stdio.h>

int main(void)
{
  int n,m,i;
  scanf("%d %d", &n, &m);
  long long h[n+1];
  for(i=1;i<=n;i++) scanf("%lld", &h[i]);

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

  int g[n+1];
  for(i=1;i<=n;i++) g[i]=1;

  for(i=1;i<=n;i++){
    if(g[i]==0) continue;
    for(int j=0;j<m;j++){
      if(a[j]==i || b[j]==i){
        if(h[a[j]]<h[b[j]]) g[a[j]]=0;
        if(h[a[j]]>h[b[j]]) g[b[j]]=0;
        if(h[a[j]]==h[b[j]] && (g[a[j]]==0 || g[b[j]] == 0)) g[a[j]]=g[b[j]]=0;
      }
    }
  }

  int ans=0;
  for(i=1;i<=n;i++){
    //printf("%d: %d\n", i, g[i]);
    if(g[i]==1) ans++;
  }
  printf("%d", ans);
  return 0;
}    