#include <stdio.h>

int main() 
{

    long int tenboudai, miti;
    long long int hyoko[100001];
    long int good[100001] = {1};

    scanf("%ld %ld", &tenboudai, &miti);
    for (int i = 0; i < tenboudai; i++){
        scanf("%lld", &hyoko[i]);
    }

    long a, b;
    for (int i = 0; i < miti; i++){
        scanf("%ld %ld", &a, &b);
        if( hyoko[a-1] > hyoko[b-1] ){
            good[a-1] = 3;
            if( good[b-1] != 3 ){
               good[b-1] = 0;
            }
        } else {
            if( good[a-1] != 3 ){
               good[a-1] = 0;
            }
            good[b-1] = 1;
        }
    }

    long int count = 0;

    for (int i = 0; i < tenboudai; i++ ){
        if ( good[i] != 0 ){
            count++;
        }
    }
    printf("%ld", count);

    return 0;
}

