#include <stdio.h>

int main()
{

    int n, k;
    scanf("%d %d", &n, &k);
    long high[100001];
    int legg[100001];
    //道がkこ

        for (int i = 0; i < n; i++)
    {
        scanf("%ld", &high[i]);
        legg[i] = 1;
    }//高さ


  
    int a;
    int b;
    for (int i = 0; i < k; i++){
        scanf("%d %d", &a, &b);
    if(high[a-1]>high[b-1])
    legg[b - 1] = 0;
    else if (high[a - 1] < high[b - 1])
        legg[a - 1] = 0;
    else{
        legg[b - 1] = 0;
        legg[a - 1] = 0;
    }

    }
    int count=0;

    for (int i = 0; i < n; i++)
    {
        if(legg[i]>0)
            count++;
    } //高さ

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