#include <stdio.h>
#include <stdlib.h>

int main(void){
    int n, m;
    int *h;
    int *a;
    int *is_good;
    int i;
    int result = 0;

    scanf("%d %d", &n, &m);
    h = (int*)malloc(sizeof(int) * n);
    is_good = (int*)malloc(sizeof(int) * n);
    a = (int*)malloc(sizeof(int) * m * 2);

    for(i = 0; i < n; i++){
        scanf("%d", h + i);
        is_good[i] = 1;
    }
    for(i = 0; i < m; i++){
        scanf("%d %d", a + (i * 2), a + (i * 2 + 1));
    }

    for(i = 0; i < m; i++){
        int h1 = h[a[i * 2] - 1];
        int h2 = h[a[i * 2 + 1] - 1];
        if(h1 <= h2)
            is_good[i * 2] = 0;
        else if(h1 >= h2)
            is_good[i * 2 + 1] = 0;
    }

    for(i = 0; i < n; i++){
        if(is_good[i] == 1)
            result++;
    }
    printf("%d\n", result);



    free(is_good);
    free(a);
    free(h);

    return 0;
}