#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define NMAX 100000
int main() {
    int N,M;
    cin>>N>>M;
    vector<int> H(N);
    bitset<NMAX> bit;
    for (int i = 0; i < N; i++){
        cin>>H[i];
    }
    for (int i = 0; i <M; i++){
        int a,b;
        cin>>a>>b;a--;b--;
        if(H[a]>=H[b])bit.set(b);
        if(H[a]<=H[b])bit.set(a);
    }
    cout<<N-bit.count()<<endl;
}