// AtCoder165 C

#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <math.h>
#include <assert.h>
#include <string.h>
#include <memory.h>
#include <malloc.h>
#include <stdlib.h>

// qsortで用いる比較用関数．*a<*bならaが先になる．
int compare(const void* a, const void* b) {
    return *(int*)a - *(int*)b;
}

int main() {
    int i;
    int tenbou_num, road_num;
    int* height;
    int cnt = 0;
    int* good;
    int a,b;

    scanf("%d %d", &tenbou_num, &road_num);
    height = (int*)calloc(tenbou_num, sizeof(int));
    good = (int*)calloc(tenbou_num, sizeof(int));
    
    for(i=0;i<tenbou_num;i++){
        scanf("%d", height+i);
    }

    for(i=0;i<road_num;i++){
        scanf("%d %d", &a, &b);
        if(height[a-1] <= height[b-1]) good[a-1] = 1;
        if(height[a-1] >= height[b-1]) good[b-1] = 1;
        
    }

    for(i=0;i<tenbou_num;i++){
        if(good[i] == 0)cnt++;
    }
    printf("%d", cnt);
    return 0;
}