#include <stdio.h>

int main() {
 int n,m,height,i,x,y;
 int ans;
 
 scanf("%d %d", &n, &m);
 
 int s[n];
 for(i = 0; i < n; i++) {
   scanf("%d", &height);
   s[i] = height;
 }
 
 int score[n];
 for(i = 0; i < m; i++) {
   scanf("%d %d", &x, &y);
   score[x] = 1;
   if (!(s[x - 1] == s[y - 1]))
     score[y] = 2;
 }
 
 ans = 0;
 for(i = 0; i < n; i++) {
   if (score[i] == 0 || score[i] == 2)
     ans++;
 }

 printf("%d", ans);
 return(0);
}