#include<stdio.h>

int main(void)
{
    int N, M, i, A, B, count=0;

    scanf("%d",&N);
    scanf("%d",&M);
    long H[N], H2[N];

    for(i=0; i<N; i++) {
        scanf("%ld",&H[i]);
        H2[i] = 0;
    }

    for(i=0;i<M;i++) {
        scanf("%d",&A);
        scanf("%d",&B);
        if(H[A-1] < H[B-1]) {
            H2[B-1] = 1;
            H2[A-1] = 0;
        } else if(H[A-1] > H[B-1]) {
            H2[A-1] = 1;
            H2[B-1] = 0;
        } 
    }

    for(i=0;i<N;i++) {
        if(H2[i] == 0) {
            count++;
        } 
    }

    printf("%d\n",count);

    return 0;
}
