#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define Rep(i,a,n)for(int i=(int)(a);i<(int)(n);i++)
#define rep(i,n)Rep(i,0,n)
typedef long long ll;
typedef long double ld;
#define Ma(x,y) ((x)>(y)?(x):(y))
#define mi(x,y) ((x)<(y)?(x):(y))
#define N 100002

int main() {
	int n, m, h[N], a, b, good[N] = { 0 },ans=0;
	scanf("%d %d", &n, &m);
	Rep(i,1,n+1)scanf("%d", &h[i]);
	Rep(i,1,m+1) {
		scanf("%d %d", &a, &b);
		if (h[a] > h[b])good[b]--;
		else if (h[a] < h[b])good[a]--;
		else { good[a]--; good[b]--; }
	}
	Rep(i, 1, n + 1) {if (good[i] == 0)ans++; }
	printf("%d", ans);
}