#include <iostream>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;

int main(){
    int n,m;
    cin >> n >> m;
    int h[n],a,b;
    rep(i,n) cin >> h[i];
    int highest[100010]={0};
    rep(i,m){
        cin >> a >> b;
        highest[a] = max(highest[a], h[b]); 
        highest[b] = max(highest[b], h[a]);

    }
    int result=0;
    for(int i=0; i<n-1; i++){
        if(h[i]>highest[i]){
            result++;
        }
    }

    cout << result << endl;
    return 0;
}