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

int maxind(int *H);

int M;
int N;
int *H;
int *A;
int *B;
int *T;

int main(void)
{
    int c;
    int ans = 0;
    int max;
    int temp;
    int start;
    scanf("%d", &N);
    scanf("%d", &M);
    H = (int *)malloc(sizeof(int) * N);
    A = (int *)malloc(sizeof(int) * M);
    B = (int *)malloc(sizeof(int) * M);
    T = (int *)malloc(sizeof(int) * N);
    for (c = 0; c < N; ++c)
    {
        scanf("%d", H + c);
        T[c] = c;
    }
    for (c = 0; c < M; ++c)
    {
        scanf("%d", A + c);
        scanf("%d", B + c);
        --A[c];
        --B[c];
    }
    max = maxind(H);
    start = H[max];
    while (start > 0)
    {
        H[max] *= -1;
        temp = 1;
        for (c = 0; c < M; ++c)
        {
            if (A[c] == max)
            {
                if (abs(H[B[c]]) == start)
                {
                    temp = 0;
                }
                if (H[B[c]] > 0)
                {
                    H[B[c]] *= -1;
                }
            }
            else if (B[c] == max)
            {
                if (abs(H[A[c]]) == start)
                {
                    temp = 0;
                }
                if (H[A[c]] > 0)
                {
                    H[A[c]] *= -1;
                }
            }
        }
        ans += temp;
        max = maxind(H);
        start = H[max];
    }
    printf("%d", ans);
    free(A);
    free(B);
    free(H);
    free(T);
    return 0;
}

int maxind(int *H)
{
    int temp = H[0];
    int ans = 0;
    int c;
    for (c = 1; c < N; ++c)
    {
        if (H[c] > temp)
        {
            temp = H[c];
            ans = c;
        }
    }
    return ans;
}