#include<bits/stdc++.h> 
using namespace std;
#define ll long long int

int main(){
  ll n,m;
  cin>>n>>m;
  vector<ll> g(n);
  vector<ll> a(n);
  for(ll i=0;i<n;i++) cin>>a[i];
  for(ll i=0;i<m;i++){
    ll x,y;
    cin>>x>>y;
    g[x-1]=max(g[x-1],a[y-1]);
    g[y-1]=max(g[y-1],a[x-1]);
  }
  
  ll ans=0;
  for(ll i=0;i<n;i++){
  	if(g[i]<a[i]) ans++;
  }
  cout<<ans<<endl;
}
