#include <stdio.h>
#include <malloc.h>
#include <string.h>

int main()
{
	int n, m;
	int* h/*標高*/, * a, * b/*展望台を結ぶ道*/;
	scanf("%d %d", &n, &m);
#pragma region input
	h = (int*)malloc(sizeof(int) * n);
	a = (int*)malloc(sizeof(int) * m);
	b = (int*)malloc(sizeof(int) * m);
	for (int i = 0; i != n; i++)
	{
		scanf("%d", h + i);
	}
	for (int i = 0; i != m; i++)
	{
		scanf("%d %d", a + i, b + i);
	}
#pragma endregion

	short* s = (short*)malloc(n * sizeof(short));
	memset(s, 1, sizeof(short));

	for (int i = 0; i != m; i++)
	{
		if (*(h + (*(a + i))) > * (h + (*(b + i))))
		{
			*(s + (*(b + i) - 1)) = 0;
		}
		else
		{
			*(s + (*(a + i) - 1)) = 0;
		}
	}

	int z = 0;
	for (int i = 1; i != n + 1; i++)
	{
		if (*(s + i))
		{
			z++;
		}
	}

	printf("%d", z);

	return 0;
}