#include <iostream>
#include <map>
#include <vector>
using namespace std;
int main()
{
    long int N,M,x,y,good=0;
    cin >> N >> M;
    map<int,map<int,int> > MAP;
    long long int H;
    vector<long long int> height;
    height.push_back(0);
    for(int i=1; i<=N; i++)
    {
        cin >> H;
        height.push_back(H);
    }
    for(int i=1;i<=M;i++)
    {
        cin >> x >> y;
        MAP[x][y]++;
        MAP[y][x]++;
    }
    for(int i=1; i<=N; i++)
    {
        bool great=true,singlepath=false; 
        if((MAP[i].size())==0)
        {
            continue;
        }       
        for (auto it1=MAP[i].begin(); it1!=MAP[i].end(); it1++)
        {
            if( height[i] < height[it1->first] )
            {
                great=false;
            }  
            if(MAP[i][it1->first]==1)
            {
                singlepath=true;
            }
        }
        if((great&&singlepath) || (great && (!singlepath)) )
        {
            good++;
        }
    }
    cout << good;

    return 0;
}
