#include <bits/stdc++.h>
using namespace std;
#define REP(i,x,n) for(int i=x;i<(int)n;i++)
#define rep(i,n) REP(i,0,n)
#define sp(p) cout<<setprecision(16)<<fixed<<p<<endl;
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define UNIQ(a) unique(all(a))
#define UNIQNUM(a) UNIQ(a)-a.begin()
#define UNIQIT(a) a.erase(UNIQ(a), a.end());
#define VOUT(v,i) rep(i,v.size())cout<<v[i]<<(i==v.size()-1?"\n":" ");
#define vout(v) VOUT(v,z);
#define vdbg(v,i) cout<<#v<<": ";for(int i=0;i<(int)v.size();i++){cout<<v[i]<<" ";}cout<<"\n";
#define vmin(v) *min_element(all(v))
#define vmax(v) *max_element(all(v))
#define vsum(v) accumulate(all(v), 0LL)
#define MOUT(m,r,c) rep(i,r){rep(j,c){cout<<m[i][j]<<" ";}cout<<endl;}
#define mout(m) MOUT(m,m.size(),m[0].size())
#define debg(a) cout<<#a<<": "<<a<<endl;
#define show(a) for(cont &y:a){for(cont &x:y){cout<<x<<" ";}cout<<endl;}
#define digit(a) to_string(a).length();
template<class T>inline int out(const T &t){ print(t); putchar('\n'); return 0; }
// template<class T>inline T gcd(T a,T b){if(b==0)return a; return(gcd(b,a%b));}
// template<class T>inline T lcm(T a,T b){return a/gcd(a,b)*b;}
bool is_palindrome(string s){return s == string(s.rbegin(),s.rend());}
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
// const long long MOD=1000000007;
const long long INF = 1e18;
#define EPS (1e-7)
#define PI (acos(-1))
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) { a = b; return true; }
    return false;
}
template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) { a = b; return true; }
    return false;
}


struct UnionFind {
  vector< int > data;

  UnionFind() = default;

  explicit UnionFind(size_t sz) : data(sz, -1) {}

  bool unite(int x, int y) {
    x = find(x), y = find(y);
    if(x == y) return false;
    if(data[x] > data[y]) swap(x, y);
    data[x] += data[y];
    data[y] = x;
    return true;
  }

  int find(int k) {
    if(data[k] < 0) return (k);
    return data[k] = find(data[k]);
  }

  int size(int k) {
    return -data[find(k)];
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }
};


int main(){
    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    // std::vector<long long> H(N);
    // for(int i = 0 ; i < N ; i++){
    //     scanf("%lld",&H[i]);
    // }
    std::vector<pair<ll,ll>> H(N);
    for(int i = 0 ; i < N ; i++){
        // scanf("%lld",&H[i]);
        ll t;
        cin >> t;
        auto p = make_pair(t, i+1);
        H[i]=p;
    }
    std::vector<long long> A(M);
    std::vector<long long> B(M);
    vector<vector<ll>> g(N+1);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
        g[A[i]].push_back(B[i]);
        g[B[i]].push_back(A[i]);
    }
    // for (long long i = 0; i < N; i++) {
    //     cout << g[i].size() << endl;
    //     vout(g[i]);
    // }

    ll cnt=0;
    // RSORT(H);

    // UnionFind uf(N+1);
    // for (long long i = 0; i < M; i++) {
    //     uf.unite(A[i],B[i]);
    // }
    // for (long long i = 0; i < N; i++) {
    //     ll idx=H[i].second;
    //     bool f=false;
    //     for (long long j = 1; j < N; j++) {
    //         if(uf.same(idx,j) && H[idx].first <= H[j].first){
    //             f=true;
    //             break;
    //         }
    //     }
    //     if(f==false) cnt++;
    // }

    vector<bool> f(N+1);
    for (auto& e: H) {
        ll idx=e.second;
        bool f=false;
        for (long long j = 0; j < g[idx].size(); j++) {
            ll ti = g[idx][j];
            // debg(ti);
            // debg(H[ti].first);
            if(H[ti-1].first >= e.first){
                f=true;
                break;
            }
        }
        // debg(idx);
        // debg(f);
        if(f==false) cnt++;
    }

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 12296