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

int h[100005], gd[100005];

int main() {
    int n, m;
    scanf("%d %d", &n, &m);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &h[i]);
        gd[i] = 1;
    }
    for (int i = 0; i < m; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        if (h[a] > h[b]) gd[b] = 0;
        else if (h[a] == h[b]) gd[a] = 0, gd[b] = 0;
        else gd[a] = 0;
    }
    int ans = 0;
    for (int i = 1; i <= n; i++)
        if (gd[i]) ans++;
    printf("%d\n", ans);
}