#include<bits/stdc++.h>
using namespace std;

/*** Typedef ***/
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
/*** Loops ***/
#define ffit(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)
#define ff1(i,a,b) for(ll i = a; i <b; i++)
#define ff2(i,a,b) for(ll i = b-1; i >= a; i--)
#define ff3(i,a,b,m) for(ll i = a; i <=b; i+=m)
#define ipar(ar,n) ll ar[n]; ff1(i,0,n) cin>>ar[i];
#define opar(ar,n) ff1(i,0,n) cout<<ar[i]<<" ";
#define foRev(num) for(ll i = num - 1; i >= 0; i--)
#define forIn(arr, num) for(ll i = 0; i < num; i++) sc1(arr[i]);
#define forIn1(arr, num) for(ll i = 1; i <= num; i++) sc1(arr[i]);
#define vpnt(ans) for(ll i = 0; i < ans.size(); i++) cout << ans[i] << (i + 1 < ans.size() ? ' ' : '\n');
#define apnt(arr, num) for(ll i = 0; i < num; i++) cout << arr[i] << (i + 1 < num ? ' ' : '\n');

/*** Define Values ***/
//#define mod 1000000007
#define PI acos(-1.0)
#define eps 1e-7
#define size1 15

/*** STLs ***/
#define rsz resize
#define ins insert
#define ft front
#define bk back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define mem(name, value) memset(name, value, sizeof(name))
#define MN3(n1,n2,n3) min(n1,min(n2,n3))
#define MN4(n1,n2,n3,n4) min(n1,min(n2,min(n3,n4)))
#define MX3(n1,n2,n3) max(n1,max(n2,n3))
#define MX4(n1,n2,n3,n4) max(n1,max(n2,max(n3,n4)))
#define endl " \n"

/*** STLs ***/
typedef vector <ll> vll;
#define vvll vector<vll>
typedef set <ll> sll;
typedef multiset <ll> msll;
typedef queue <ll> qll;
typedef map <ll, ll> mll;
typedef pair <ll, ll> pll;
typedef vector <pair <ll, ll> > vpll;

///vector<vector<int>> v(10, vector<int>(20,500)); 2d vector initialization. of 10 rows and 20 columns, with value 500.

/*** Sorts ***/
#define all(v) (v).begin(), (v).end()
#define rev(v) reverse(all(v))
#define srt(v) sort(all(v))
#define srtgrt(v) sort(all(v), greater<ll>())
#define prsrt greater<pair<int,int>>()
/*** Some Prints ***/
#define q2(n) (n%2)==0
#define ip(n) ll n; cin>>n;
#define ip2(n,k) ll n; cin>>n; ll k; cin>>k;
#define en cout << '\n';
#define no cout << "NO" << '\n'
#define yes cout << "YES" << '\n'
#define case cout << "Case " << t++ << ": ";
#define ps(x,y)         fixed<<setprecision(y)<<x
#define inf             1e18
#define debug(x) cout << '>' << #x << ':' << x << endl;
//const ll N = 1e6 + 9;
#define w(x)             ll x; cin>>x; while(x--)
/*
/// parity bhi kuch hoti h naagin wali class attend krni chahiye thi
int parity_check(int n)
{
	int par=n;
	par = par ^ (par >> 1);
    par = par ^ (par >> 2);
    par = par ^ (par >> 4);
    par = par ^ (par >> 8);
    par = par ^ (par >> 16);

    if(par%2==1)
    {
    	return 1;
    }
    else
    {
    	return 0;
    }
}


/// Bs itni hi DP aati h merko
int lcs( string X, string Y, int m, int n )
{
    int L[m + 1][n + 1];
    int i, j;

    for (i = 0; i <= m; i++)
    {
        for (j = 0; j <= n; j++)
        {
        if (i == 0 || j == 0)
            L[i][j] = 0;

        else if (X[i - 1] == Y[j - 1])
            L[i][j] = L[i - 1][j - 1] + 1;

        else
            L[i][j] = max(L[i - 1][j], L[i][j - 1]);
        }
    }

    return L[m][n];
}


ll gcd(ll a,ll b)
{
	if(a==0)
	{
		return b;
	}
	return gcd(b%a,a);
}


ll lcm(ll a,ll b)
{
	ll pro=a*b;
	ll ans=gcd(a,b);
	pro=pro/ans;
	return pro;
}


/// beware of the speed(Accident prone area)
ll fast_power(ll a,ll b,ll p)
{
	if(b==0)
	{
		return (1%p);
	}
	ll t=fast_power(a,b/2,p);
	ll ans=(t*t)%p;
	if(b%2)
	{
		ans=(ans*(a%p))%p;
	}
	return ans;
}


/// prime check bhi krlo maja aayega
bool prime_check(ll n){
	ll i,j;
	if(n==1)
	{
		return false;
	}
	for(i=2;i<=sqrt(n);i++)
	{
		if(n%i==0)
		{
			return false;
		}
	}
	return true;
}


ll fact(ll n,ll mod)
{
	ll prod=1;
	for(ll i=1;i<=n;i++)
	{
		prod=(prod*i)%mod;
	}
	return prod;
}
ll fac[500001];
void calc_fac(ll mod)
{
	fac[0]=1;
	for(int i=1;i<=500000;i++)
	{
		fac[i]=(fac[i-1]*i)%mod;
	}
}
ll comb(ll n,ll r,ll mod)
{
	if(r>n)
	{
		return 0;
	}
	ll ans=fac[n];
	ll den=(fac[n-r]*fac[r])%mod;
	ans=(ans*fast_power(den,mod-2,mod))%mod;
	return ans;
}


const int M = (int)(2e6 + 239);

int pref[M], c;

string solve_palindrome(const string& s)
{
    string a = s;
    reverse(a.begin(), a.end());
    a = s + "#" + a;
    c = 0;
    for (int i = 1; i < (int)a.size(); i++)
    {
        while (c != 0 && a[c] != a[i])
            c = pref[c - 1];
        if (a[c] == a[i])
            c++;
        pref[i] = c;
    }
    return s.substr(0, c);
}
/// bhai sahab sieve use krni bhi jaruri hai

/// be careful sieve ahead
void mera_sieve()
{
    bool prime[6000013];
    memset(prime, true, sizeof(prime));

    for (ll p=2; p*p<=6000012; p++)
    {
        if (prime[p] == true)
        {
        	//pr.pb(p);
            for (ll i=p*p; i<=6000012; i += p)
                prime[i] = false;
        }
    }
    for(ll i=2;i<=6000012;i++)
    {
    	if(prime[i])
    	{
    		//pr.pb(i);
		}
	}
}

/// ab driver gaadi chalayega savdhan
int fastExponentiation(int n, int x, int modulo)
{
	int res = 1;
	while(x > 0)
       {
          if(x & 1)
          res = (res*n) % modulo;
          x = x >> 1;
          n = (n * n) % modulo;
       }
       return res;
}


int power(int n , int p ){
	if(p==0)
	   return 1;

	 int res = power((n*n)%mod,p/2);
	 if(p%2==1)
	   res = (n*res)%mod;

	   	 return res;
}

bool isPowerOfTwo(int n)
{
   if(n==0)
   return false;

   return (ceil(log2(n)) == floor(log2(n)));
}
bool isvwl(char ch) {
    if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u')
         return true;
    else return false;
}
bool cmp(string s,string s1)
{
    if(s.size() == s1.size())
    {
        return s<s1;
    }
    else
        return s.size()<s1.size();
}
*/
#define sz(x)  x.size()
#define go(i, a) for (auto i : a)

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
 ip2(n,m);
 ipar(a,n); vll v(n,1);
 while(m--)
 {
     ip2(b,c);
     if(a[b-1]>=a[c-1]) v[c-1] = 0;
     if(a[b-1]<=a[c-1]) v[b-1] = 0;
 }ll sm= 0;
 go(i,v)
 {
     sm+=i;
 }
 cout<<sm;
	return 0;

}





Measured memory_bytes: 4772