//
//  main.c
//  material
//
//  Created by 古屋和樹 on 2020/02/14.
//  Copyright © 2020 古屋和樹. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    int n, m, count = 0;
    scanf("%d%d\n", &n, &m);
    
    long h[n];
    int a[n],b[n];
    
    for(int i = 0; i < n; i++){
        scanf("%ld", &h[i]);
    }
    
    for (int i = 0; i < m; i++) {
        scanf("%d%d", &a[i], &b[i]);
    }
    
    for(int i = 0; i < n; i++){
        for (int j = 0; j < m; j++) {
            if ((a[j] == i-1 && h[i] < h[b[j]-1])|| (b[i] == i-1&& h[i] < h[b[j]-1])) {
                break;
            }else if (j == m-1){
                count++;
            }
        }
    }
    
    printf("%d", count);
    
    return 0;
}