#include<stdio.h>
#define rep(i,N) for(int i=0;i<(int)N;i++)
int main(void)
{
  int N,M,A,B,count,H[100001]={0},tip[100001]={0};
  count=scanf("%d %d",&N,&M);
  rep(i,N)count=scanf("%d",&H[i]);
  rep(i,M){count=scanf("%d %d",&A,&B);A--,B--;if(H[A]<=H[B])tip[A]=1;if(H[A]>=H[B])tip[B]=1;}
  count=N;
  rep(i,N)count-=tip[i];
  return printf("%d\n",count),0;
}