#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define ll long long int

int main(){
  ll n,m;
  scanf("%lld%lld",&n,&m);
  ll h[100001];
  ll yoi[100001]={};
  for(ll i=1;i<=n;i++){
    scanf("%lld",&h[i]);}
  ll ans=n;
  int a,b;
  for(int i=0;i<m;i++){
    scanf("%d%d",&a,&b);
    if(h[a]>h[b]){
      yoi[b]=1; continue;}
    if(h[a]<h[b]){
      yoi[a]=1; continue;}
    yoi[a]=1;
    yoi[b]=1;}

  for(int i=1;i<=n;i++){
    if(yoi[i]==1) ans--;}

  printf("%lld\n",ans);
  
  return 0;
}
