#include<stdio.h>

int main(){
    int n;scanf("%d",&n);
    int k;scanf("%d",&k);
    int arr[n];
    int i=0;
    while(i<n){
        scanf("%d",&arr[i++]);
    }
    int arr2[n];
    int j=0;
    while(j<n){
        arr2[j]=1;j++;
    }
    while(k--){
        int a;int b;scanf("%d %d",&a,&b);a--;b--;
        if(arr2[b]!=2){
        if(arr[b]>=arr[a])arr2[b]=0;
        else arr2[b]=2;}
    }
    int kl=0,flag=0;
    while(kl<n){
        if(arr2[kl]==0)flag++;kl++;
    }printf("%d",flag);
}