# Problem C - Peaks



# input

N, M = list(map(int, input().split()))

h_list = list(map(int, input().split()))



# initialization

score_list = [0]*N

for i in range(M):

    a, b = list(map(int, input().split()))

    if h_list[a-1]<h_list[b-1]:

        if h_list[b-1]>=0:

            score_list[b-1] += 1

        else:

            score_list[b-1] = -1 * float("INF")

        score_list[a-1] = -1 * float("INF")

    elif h_list[a-1]>h_list[b-1]:

        if h_list[a-1]>=0:

            score_list[a-1] += 1

        else:

            score_list[a-1] = -1 * float("INF")

        score_list[b-1] =  -1 * float("INF")

    else:

        score_list[a-1] = -1 * float("INF")

        score_list[b-1] = -1 * float("INF")



# output

ans = 0

for s in score_list:

    if s>=0:

        ans += 1

print(ans)

# Problem C - Peaks



# input

N, M = list(map(int, input().split()))

h_list = list(map(int, input().split()))



# initialization

ans_list = [1]*N

ans = 0



# count

for m in range(M):

    a, b = list(map(int, input().split()))

    if h_list[a-1]>h_list[b-1]:

        ans_list[b-1] = -1

    elif h_list[a-1]<h_list[b-1]:

        ans_list[a-1] = -1

    else:

        ans_list[a-1] = -1

        ans_list[b-1] = -1



# check

for a in ans_list:

    if a>0:

        ans += 1



# output

print(ans)

# Problem C - Peaks
# input
N, M = list(map(int, input().split()))
h_list = list(map(int, input().split()))
# initialization
score_list = [0] * N
for i in range(M):
    a, b = list(map(int, input().split()))
    if h_list[a - 1] < h_list[b - 1]:
        if h_list[b - 1] >= 0:
            score_list[b - 1] += 1
        else:
            score_list[b - 1] = -1 * float("INF")
        score_list[a - 1] = -1 * float("INF")
    elif h_list[a - 1] > h_list[b - 1]:
        if h_list[a - 1] >= 0:
            score_list[a - 1] += 1
        else:
            score_list[a - 1] = -1 * float("INF")
        score_list[b - 1] = -1 * float("INF")
    else:
        score_list[a - 1] = -1 * float("INF")
        score_list[b - 1] = -1 * float("INF")
# output
ans = 0
for s in score_list:
    if s >= 0:
        ans += 1
print(ans)

# Problem C - Peaks
# input
N, M = list(map(int, input().split()))
h_list = list(map(int, input().split()))
# initialization
ans_list = [1] * N
ans = 0
# count
for m in range(M):
    a, b = list(map(int, input().split()))
    if h_list[a - 1] > h_list[b - 1]:
        ans_list[b - 1] = -1
    elif h_list[a - 1] < h_list[b - 1]:
        ans_list[a - 1] = -1
    else:
        ans_list[a - 1] = -1
        ans_list[b - 1] = -1
# check
for a in ans_list:
    if a > 0:
        ans += 1
# output
print(ans)

-score_list = [0] * N -for i in range(M): +ans_list = [1] * N +ans = 0 +# count +for m in range(M): -    if h_list[a - 1] < h_list[b - 1]: -        if h_list[b - 1] >= 0: -            score_list[b - 1] += 1 -        else: -            score_list[b - 1] = -1 * float("INF") -        score_list[a - 1] = -1 * float("INF") -    elif h_list[a - 1] > h_list[b - 1]: -        if h_list[a - 1] >= 0: -            score_list[a - 1] += 1 -        else: -            score_list[a - 1] = -1 * float("INF") -        score_list[b - 1] = -1 * float("INF") +    if h_list[a - 1] > h_list[b - 1]: +        ans_list[b - 1] = -1 +    elif h_list[a - 1] < h_list[b - 1]: +        ans_list[a - 1] = -1 -        score_list[a - 1] = -1 * float("INF") -        score_list[b - 1] = -1 * float("INF") +        ans_list[a - 1] = -1 +        ans_list[b - 1] = -1 +# check +for a in ans_list: +    if a > 0: +        ans += 1 -ans = 0 -for s in score_list: -    if s >= 0: -        ans += 1