#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
typedef long long ll;

int main()
{
	int n,m;
	scanf("%d%d", &n,&m);
	int h[n+1];
	int a[m+1],b[m+1];
	int i = 1;
	int log[n+1];
	while (i <= n)
	{
		scanf("%d",&h[i]);
		log[i] = i;
		i++;
	}
	i = 1;
	while (i <= m)
	{
		scanf("%d",&a[i]);
		scanf("%d",&b[i]);
		i++;
	}
	i = 1;
	int j = 1;
	while (i <= m)
	{
		if (h[a[i]] <= h[b[i]])
			log[a[i]] = -1;
		if (h[b[i]] <= h[a[i]])
			log[b[i]] = -1;
		i++;
	}
	i = 1;
	int cnt = 0;
	while (i <= n)
	{
		if (i == log[i])
			cnt++;
		i++;
	}
	printf("%d\n", cnt);
	return (0);
}
