#include<stdio.h>

#define SIZE 100002
int a[SIZE],n,m,vis[SIZE],ans;
int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
	}
	for (int i = 1; i <= m; i++)
	{
		int x, y;
		scanf("%d%d", &x, &y);
		if (a[x] < a[y])
		{
			vis[x] = 1;
		}
		if (a[x] == a[y])
		{
			vis[y]=vis[x] = 1;
		}
		if (a[x] > a[y])
		{
			vis[y] = 1;
		}
	}
	for (int i = 1; i <= n; i++)
	{
		if (vis[i] == 0)
			ans++;
	}
	printf("%d", ans);
}