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


typedef struct
{
    int height;
    int targetMaxHeight;
}Info;

#define ARRAYMAX 100010
Info InfoArray[ARRAYMAX];

#define DEBUG


int main()
{
    int i, j, k, m;

    //printf("size_t:%ld\n", sizeof(size_t));

    for (i = 0;i < ARRAYMAX;i++)
    {
        InfoArray[i].height = 0;
        InfoArray[i].targetMaxHeight = 0;
    }

    char str[1000];
    fgets(str, sizeof(str), stdin);

    char* temp;
    temp = strtok(str, " \n");
    // 展望台の数
    int TenbodaiNum = atoi(temp);
 

    // 道の数
    temp = strtok(NULL, " \n");
    int PathNum = atoi(temp);

    //高さの取得

    fgets(str, sizeof(str), stdin);

    int hoge = 0;
    temp = strtok(str, " \n");

    while (temp != NULL)
    {
        //if (hoge >= ARRAYMAX) break;
        InfoArray[hoge].height = atoi(temp);
        hoge++;
        temp = strtok(NULL, " \n");
    }

    //道情報取得
    for (i = 0;i < PathNum;i++)
    {
        int iPos1;
        int iPos2;
        fgets(str, sizeof(str), stdin);
        temp = strtok(str, " \n");
        iPos1 = atoi(temp) -1;
        temp = strtok(NULL, " \n");
        iPos2 = atoi(temp) -1;


        //if (iPos1 >= ARRAYMAX) continue;
        //if (iPos2 >= ARRAYMAX) continue;



        if (iPos1 == iPos2) continue;

        if (InfoArray[iPos1].targetMaxHeight < InfoArray[iPos2].height)
        {
            InfoArray[iPos1].targetMaxHeight = InfoArray[iPos2].height;
        }
        if (InfoArray[iPos2].targetMaxHeight < InfoArray[iPos1].height)
        {
            InfoArray[iPos2].targetMaxHeight = InfoArray[iPos1].height;
        }
    }

    // 判定
   
    int iGoodNum = 0;

    for (i = 0;i < TenbodaiNum;i++)
    {
        //if (i >= ARRAYMAX) continue;
         if (InfoArray[i].height > InfoArray[i].targetMaxHeight) iGoodNum++;
    }



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


    return 0;
}
