#include <stdio.h>

int main() 
{

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

    scanf("%ld %ld", &tenboudai, &miti);
    for (int i = 0; i < tenboudai; i++){
        scanf("%ld", &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]++;
        } else {
            good[b-1]++;
        }
    }

    long count = 0;

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

    return 0;
}

