#include<stdio.h>

#define rep(i,a,b) for(int i = a; i <= b;i++)

int main(void){
  int n,m; scanf("%d%d",&n,&m);
  long long int h[n];
  rep(i,0,n-1){
    scanf("%lld",&h[i]);
  }

  int cnt[n];
  rep(i,0,n-1){
    cnt[i] = 0;
  }

  rep(i,1,m){
    int a,b;
    scanf("%d%d",&a,&b);
    if(h[a-1] < h[b-1]){
      cnt[a-1]++;
    }
    else if(h[a-1] > h[b-1]){
      cnt[b-1]++;
    }
    else{
      cnt[a-1]++;
      cnt[b-1]++;
    }
  }

  int result = 0;
  rep(i,0,n-1){
    if(cnt[i] == 0){
      result++;
    }
  }

  printf("%d",result);
  return 0;
}
