#include<stdio.h>

#define MAX 100010

int main()
{
	int N, M;
	int i;
	int result = 0;
	int height[MAX], isOut[MAX] = {0};
	int a, b;

	scanf("%d %d", &N, &M);
	for (i = 1 ; i < N+1 ; i++)
	{
		scanf("%d", &height[i]);
	}
	
	for (i = 0 ; i < M ; i++)
	{
		scanf("%d %d", &a, &b);

		if (height[a] <= height[b])
		{
			isOut[a] = 1;
		}
		if(height[a] >= height[b])
		{
			isOut[b] = 1;
		}
	}

	for (i = 1 ; i < N+1 ; i++)
	{
		if (!isOut[i])
		{
			result ++;
		}
	}

	printf("%d\n", result);

	return 0;
}