#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(){
    int i,n,m,h[100002]={},a[100002]={},b[100002]={},zentai[100002]={},count=0;
    scanf("%d%d",&n,&m);
    for (i=0; i<n; i++) scanf("%d",&h[i]);
    for (i=0; i<m; i++) scanf("%d%d",&a[i],&b[i]);
    for (i=0; i<m; i++) {
        if (h[a[i]-1]>h[b[i]-1]) zentai[b[i]]++;
        else if (h[a[i]-1]<h[b[i]-1]) zentai[a[i]]++;
        else {zentai[a[i]]++;zentai[b[i]]++;}
    }
    
    for (i=1; i<=n; i++) {
        if (zentai[i]==0) count++;
    }
    printf("%d",count);
    return 0;
}


