#include <stdio.h>

int main(void){
	int n, m,i,count=0;
	scanf("%d %d", &n, &m);
	int h[n], good[n], jSta[m], jFin[m];
	for (i = 0; i < n; i++) {
		scanf("%d", &h[i]);
		good[i] = 0;
	}
  
	for (i = 0; i < m; i++) {
		scanf("%d %d", &jSta[i], &jFin[i]);
      if(h[jSta[i]-1] > h[jFin[i]-1]) good[jFin[i]-1]= 1;
      else if(h[jSta[i]-1] < h[jFin[i]-1])good[jSta[i]-1] = 1;
      else{good[jFin[i]-1]= 1; good[jSta[i]-1] = 1;}
	}
	for (i = 0; i < n; i++) {
		if (good[i] == 0) count++;
	}
	printf("%d", count);
}
