/** 	Author: Apoorva Mittal  **/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define vii vector<pair<int, int>>
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repD(i, a, b) for (int i = a; i >= b; i--)
#define speed                     \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
#define init(i, k) memset(i, k, sizeof i)
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define all(a) a.begin(), a.end()
#define inp(a) rep(i, 0, a.size()) cin >> a[i];
//--------------------------------------------debugging showoff---------------------------------------------------------
#define out(a)                               \
    cout << #a << ": "<<endl;                      \
    rep(i, 0, a.size()) cout << a[i] << " "; \
    cout << endl;
#define out2d(a)                \
    cout << #a << ": " << endl; \
    rep(i, 0, a.size())         \
    {                           \
        rep(j, 0, a[0].size())  \
                cout            \
            << a[i][j] << " ";  \
        cout << endl;           \
    }
#define sim template < class c
#define ris return * this
#define dor > deb & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, deb&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct deb {
#ifdef LOCAL
~deb() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define cv(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
// -DLOCAL
//--------------------------------------------useless stuff---------------------------------------------------------------------
#define flush fflush(stdout);
#define lb lower_bound
#define ub upper_bound
#define maxe *max_element
#define mine *min_element
#define umap unordered_map
#define uset unordered_set
#define mset multiset
#define pqueue priority_queue
#define precise(x) cout << fixed << showpoint << setprecision(x);
#define setbit(x) __builtin_popcountll(x)
#define gcd(a, b) __gcd(a, b)
//------------------------------------------------------------------------------------------------------------------------------
const int mod = 1e9 + 7;
// ====== Useful functions begin ======
inline int add(int a, int b) { return ((a % mod) + (b % mod)) % mod; }
inline int sub(int a, int b) { return ((a % mod) - (b % mod) + mod) % mod; }
inline int mul(int a, int b) { return ((a % mod) * (b % mod)) % mod; }
// ====== Useful functions end ======
//--------------------------------------------------------------------------------------------------------------------------------
const int inf = 1e18;
const int maxn = 1e3 + 5;
//--------------------------------------------------------------------------------------------------------------------------------

void solve()
{
    int n,m; cin>>n>>m;
    vi hght(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>hght[i];
    }
    vector<bool>vis(n+1,1);

    while(m--)
    {
        int u,v;
        cin>>u>>v;

        if(hght[v] >= hght[u])
        {
            vis[u]=0;
        }
        if(hght[u] >= hght[v])
        {
            vis[v]=0;
        }
    }
    // out(vis);
int cnt=0;
    for(int i=1;i<=n;i++)
    {
        cnt+=vis[i];
    }
    cout<<cnt<<endl;
}
signed main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    speed;
    int t = 1;
    // cin >> t;

    for (int tt = 1; tt <= t; tt++)
    {
        // cout<<"Case #"<<tt<<": ";
        solve();
    }
}

Measured memory_bytes: 3992