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

#define rep(i, n) for(int i = 0; i < n; ++i)
#define ifb(N, n) if(N & (1 << n))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
#define V [0x1000] 
#define VI(v1, i) v1[(int)i]
#define AV = calloc(0x8000, 1) 
#define VZ(v) memset(v, 0, 0x1000)
#define addv(a,b) a = (unsigned long long)a + (unsigned long long)b
#define assv(a,b) a = (unsigned long long)b
#define vi 0x7fffffffffffffff

typedef void *************** v;
typedef unsigned long long ull;

int main(void) {
    int n, m;
    scanf("%d %d", &n, &m);

    v hh V;
    rep(i, n) {
        scanf("%dll", &hh[i]);
    };
    v eee V;
    rep(i, n) {
        eee[i] AV;
    }
    rep(i, m) {
        int a,b;
        scanf("%d %d", &a, &b);
        int c = 0;
        while (eee[a - 1][c]) ++c;
        eee[a - 1][c] = b;
        c = 0;
        while (eee[b - 1][c]) ++c;
        eee[b - 1][c] = a;
    }

    v aa V;
    VZ(aa);
    rep(i, n) {
        int c = 0;
        int p = hh[i];
        while (eee[i][c]) {
            if (p >= VI(hh, eee[i][c] - 1)) VI(aa, eee[i][c] - 1) = 1;
            ++c;
        }
    }

    int ans = 0;
    rep(i, n) {
        if (!aa[i]) ++ans;
    }

    printf("%d", ans);
}