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

int n, m;
int h[100001];
int hh[100001];

int main( int argc, char *argv[] )
{
    int a, b;

    scanf( "%d %d", &n, &m );

    for( int i=1; i<=n; i++ ) 
        scanf( "%d", &h[i] );

    for( int i=0; i<m; i++ ) {

        scanf( "%d %d", &a, &b );
        if( h[a] >= h[b] ) hh[b] = 1;
        if( h[a] <= h[b] ) hh[a] = 1;
    }

    int tot = 0;
    for( int i=1; i<=n; i++ )
        if( hh[i] == 0 ) tot ++;

    printf( "%d\n", tot );
}
