int H[100010];
int ng[100010];

int main() {
	int n, m;
	scanf("%d%d",&n, &m);

	for(int i = 1; i <= n; i++)
    scanf("%d",H + i);
	for(int i = 0; i < m; i++) {
		int a, b;
		scanf("%d%d",&a, &b);
		if(H[a] <= H[b])
        ng[a] = 1;
		if(H[a] >= H[b])
        ng[b] = 1;
	}

	int ans = 0;
	for(int i = 1; i <= n; i++)
    if(!ng[i])
    ans++;
	printf("%d\n",ans);
}
