#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define F(i,a,n) for(int i=a; i<n; i++)
#define INF 100000000000 // long only

typedef struct DATA{
  int h;
  int flag;
}data;

int main(){
  int n,m;
  scanf("%d%d",&n,&m);
  long h[n];
  F(i,0,n)scanf("%ld",h+i);
  int a[m],b[m];
  F(i,0,m) scanf("%d%d",a+i,b+i);
  int ans[n];
  F(i,0,n)ans[i]=1;
  F(i,0,m){
    if(h[a[i]-1]>h[b[i]-1]) ans[b[i]-1]=0;
    else if(h[a[i]-1]==h[b[i]-1]){
      ans[a[i]-1]=0;
      ans[b[i]-1]=0;
    }
    else ans[a[i]-1]=0;
  } 
  int sum=0;
  F(i,0,n)if(ans[i]==1)sum++;
  printf("%d\n",sum);
  return 0;
}