#include <iostream>
#include <string>
#include <array>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>

using namespace std;

struct edge
{
	long long to;
};

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	long long N, M;
	cin >> N >> M;
	vector<long long> tower(N);
	vector<edge> graph[N];
	long long a, b;
	for (long long i = 0; i < N; i++)
	{
		cin >> tower[i];
	}
	for (long long i = 0; i < M; i++)
	{
		cin >> a >> b;
		edge e1 = {b - 1};
		edge e2 = {a - 1};
		graph[a - 1].push_back(e1);
		graph[b - 1].push_back(e2);
	}
	long long count, result;
	result = 0;
	for (long long i = 0; i < N; i++)
	{
		count = 0;
		for (long long j = 0; j < graph[i].size(); j++)
		{
			if (tower[i] > tower[graph[i][j].to])
				count++;
		}
		if (count == graph[i].size())
			result++;
	}
	cout << result;
	return 0;
}
