#include <stdio.h>
int main(void)
{
    int N, M;
    scanf("%d %d", &N, &M);

    int H[N]; // 展望台の標高
    int A[M]; // 道の両端の展望台の組み合わせ
    int B[M];

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

    for(int i=0; i<M; i++){
        scanf("%d %d", &A[i], &B[i]);
    }
    int count_ans = 0;
    int conut_node[N];
    int count_h[N];

    for(int i=0; i<N; i++){ // 初期化
        count_h[i] = 0;
        conut_node[i] = 0;
    }

    for(int i=0; i<M; i++){
        if(H[A[i]-1]>H[B[i]-1]){
            count_h[A[i]-1]++;
        }else if(H[A[i]-1]<H[B[i]-1]){
            count_h[B[i]-1]++;
        }
        conut_node[A[i]-1]++;
        conut_node[B[i]-1]++;
    }

    for(int i=0; i<N; i++){
        if(count_h[i] == conut_node[i]){
            count_ans++;
        }
    }
     printf("%d\n", count_ans);


    //for(int i=0; i<M; i++){
    //    printf("%d ", H[i]);
    //    printf("%d %d\n", A[i], B[i]);
    //}

   return 0;
}