#include<stdio.h>
#define ll long long 
ll llmax(ll a, ll b){return a > b ? a : b;}
int main(){
    int n,m;
    scanf("%d%d",&n,&m);
    ll h[n + 1];
    int a[m + 1], b[m + 1];
    for(int i = 1; i <= n; i++)
        scanf("%lld",&h[i]);
    for(int i = 1; i <= m; i++)
        scanf("%d%d",&a[i],&b[i]);
    int ans = 0;
    ll p[n + 1];
    for(int i = 0; i <= n; i++)
        p[i] = -1;
    for(int i = 1; i <= m; i++){
        ll q = h[a[i]];
        ll r = h[b[i]];
        if(q < r){
            if(p[b[i]] != 0){
                p[a[i]] = 0;
                p[b[i]] = 1;
            }
            p[a[i]] = 0;
        }
        else if(q > r){
            if(p[a[i]] != 0){
                p[a[i]] = 1;
                p[b[i]] = 0;
            }
            p[b[i]] = 0;
        }
        else{
            p[a[i]] = 0;
            p[b[i]] = 0;
        }
    }
    for(int i = 1; i <= n; i++)
        if(p[i] == -1)
            p[i] = 1;
    for(int i = 1; i <= n; i++)
        if(p[i] == 1)
            ans ++;
    printf("%d\n",ans);
    return 0;
}