from sys import stdin, setrecursionlimit



setrecursionlimit(10 ** 9)





def input():

    return stdin.readline().strip()



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

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

g = [list() for _ in range(N)]

for i in range(M):

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

    a -= 1

    b -= 1

    g[a].append(b)

    g[b].append(a)



ans = 0

for i in range(N):

    good = True

    for j in g[i]:

        if H[i] <= H[j]:

            good = False



    ans += good



print(ans)

from sys import stdin, setrecursionlimit



setrecursionlimit(10 ** 9)





def input():

    return stdin.readline().strip()





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

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

ans = [True] * N

for _ in range(M):

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

    a -= 1

    b -= 1

    if H[a] < H[b]:

        ans[a] = False

    elif H[a] > H[b]:

        ans[b] = False

    else:

        ans[a] = False

        ans[b] = False



print((sum(ans)))

from sys import stdin, setrecursionlimit

setrecursionlimit(10**9)


def input():
    return stdin.readline().strip()


N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
g = [list() for _ in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    g[a].append(b)
    g[b].append(a)
ans = 0
for i in range(N):
    good = True
    for j in g[i]:
        if H[i] <= H[j]:
            good = False
    ans += good
print(ans)

from sys import stdin, setrecursionlimit

setrecursionlimit(10**9)


def input():
    return stdin.readline().strip()


N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
ans = [True] * N
for _ in range(M):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    if H[a] < H[b]:
        ans[a] = False
    elif H[a] > H[b]:
        ans[b] = False
    else:
        ans[a] = False
        ans[b] = False
print((sum(ans)))

-g = [list() for _ in range(N)] -for i in range(M): +ans = [True] * N +for _ in range(M): -    g[a].append(b) -    g[b].append(a) -ans = 0 -for i in range(N): -    good = True -    for j in g[i]: -        if H[i] <= H[j]: -            good = False -    ans += good -print(ans) +    if H[a] < H[b]: +        ans[a] = False +    elif H[a] > H[b]: +        ans[b] = False +    else: +        ans[a] = False +        ans[b] = False +print((sum(ans)))