#include <iostream>
#include <vector>
#include <string>
#include <cctype>
#include <cmath>
#include <iomanip>
#include <climits>
#include <cfloat>
#include <algorithm>
#include <memory>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned uint;
typedef long double l_double;

#define vtr vector
#define PB push_back
#define EB emplace_back
#define gcd __gcd
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define st_ct static_cast // <>
#define TEST uint _ {}; cin >> _; while (_--)
#define PI (3.1415926535897932384626433832795)
#define MOD st_ct<int>(1e9 + 7)
#define EPS 1e-9
#define deb1(x) cerr << #x << " -> " << x << endl;
#define deb2(x,y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ")" << endl;
#define deb3(x,y,z) cerr << "(" << #x << ", " << #y << ", " << #z << ") -> (" << x << ", " << y << ", " << z << ")" << endl;
#define debVV(V) cerr << #V << ":\n" << V << endl; // 2D

// 1D
template<typename T>
istream& operator>>(istream &is, vector<T> &A) {
    for (T &v: A)
        is >> v;
    return is;
}

template <typename T>
ostream& operator<<(ostream &os, const vector<T> &A) {
    for (T const &v: A)
        os << v << " ";
    return os;
}

template<typename T>
void vtrV(const vector<T> &A)
{ for (T const &val: A) cout << val << endl; }

// 2D
template<typename T>
istream& operator>>(istream &is, vector<vector<T>> &A) {
    for (vector<T> &i: A)
        for (T &j: i)
            is >> j;
    return is;
}

template <typename T>
ostream& operator<<(ostream &os, const vector<vector<T>> &A) {
    for (vector<T> const &i: A) {
        for (T const &j: i)
            os << j << " ";
        os << endl;
    }
    return os;
}

template<typename T>
void vvtrNS(const vector<vector<T>> &A) {
    for (vector<T> const &i: A) {
        for (T const &j: i)
            cout << j;
        cout << endl;
    }
}

template<typename T>
T cntDigits(const T &N) { return (floor(log10(N)) + 1); }

template<typename T>
bool isPowOfTwo(const T &N) { return (N && (!(N&(N-1)))); }

template<typename T>
T lcm(T a, T b) { return ((a*b)/gcd(a, b)); }
/* -------------------------------------------------------- */
/* -------------------------------------------------------- */

class Obs {
public:
	int height;
	vtr<int> reach;
	// int index;

	Obs(const int &h = -1, const vtr<int> &r = vtr<int> {});

};

Obs::Obs(const int &h, const vtr<int> &r)
	:height {h}, reach {r} {}

bool heightThanReach(const vtr<Obs> &arr, const vtr<int> &reach, const int &hgt) {
	for (auto const &h: reach) {
		if (hgt <= arr.at(h).height)
			return false;
	}
	return true;
}

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    // cout.setf(std::ios::boolalpha);
    cout<<std::fixed;
    cout<<std::setprecision(6); // default
    /* -------------------------------- */

    int n {}, m {};
    cin >> n >> m;

    vtr<Obs> arr (n);
    for (auto &ob: arr) {
    	cin >> ob.height;
    }

    while (m--) {
    	int r1 {}, r2 {};
    	cin >> r1 >> r2;
    	arr.at(r1-1).reach.EB(r2-1);
    	arr.at(r2-1).reach.EB(r1-1);
    }

    int ans {};
    for (auto const &ob: arr) {
    	if (ob.reach.empty() || heightThanReach(arr, ob.reach, ob.height))
    		++ans;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 9228