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

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



g = [[] for i in range(N)]

for i in range(M):

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

    g[a-1].append(b-1)

    g[b-1].append(a-1)





d = [[0, -1]]

ans = 0

is_visit = [False] * N

def search(node):

    global is_visit

    global ans

    d = [node]

    while d:

        node = d.pop()

        h = H[node]

        children = g[node]

        res = True

        for child in children:

            _h = H[child]

            res *= h > _h

            if not is_visit[child]:

                is_visit[child] = True

                d.append(child)

        

        ans += res





for i in range(N):

    if not is_visit[i]:

        is_visit[i] = True

        search(i)



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

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

g = [[] for i in range(N)]

for i in range(M):

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

  g[a-1].append(b-1); g[b-1].append(a-1)



ans = 0

for i in range(N):

  neighbors = g[i]

  h = H[i]

  res = True

  for node in neighbors:

    res *= h > H[node]

  ans += res



print(ans)
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
d = [[0, -1]]
ans = 0
is_visit = [False] * N


def search(node):
    global is_visit
    global ans
    d = [node]
    while d:
        node = d.pop()
        h = H[node]
        children = g[node]
        res = True
        for child in children:
            _h = H[child]
            res *= h > _h
            if not is_visit[child]:
                is_visit[child] = True
                d.append(child)
        ans += res


for i in range(N):
    if not is_visit[i]:
        is_visit[i] = True
        search(i)
print(ans)

N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
g = [[] for i in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    g[a - 1].append(b - 1)
    g[b - 1].append(a - 1)
ans = 0
for i in range(N):
    neighbors = g[i]
    h = H[i]
    res = True
    for node in neighbors:
        res *= h > H[node]
    ans += res
print(ans)

-d = [[0, -1]] -is_visit = [False] * N - - -def search(node): -    global is_visit -    global ans -    d = [node] -    while d: -        node = d.pop() -        h = H[node] -        children = g[node] -        res = True -        for child in children: -            _h = H[child] -            res *= h > _h -            if not is_visit[child]: -                is_visit[child] = True -                d.append(child) -        ans += res - - -    if not is_visit[i]: -        is_visit[i] = True -        search(i) +    neighbors = g[i] +    h = H[i] +    res = True +    for node in neighbors: +        res *= h > H[node] +    ans += res