def Is(): return list(map(int, input().split()))  # '123 456' -> 123, 456

def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]





N, M = Is()

H = LI()

AB = [set() for _ in range(N)]

for i in range(M):

    a, b = Is()

    a -= 1

    b -= 1

    AB[a].add(b)

    AB[b].add(a)



ans = 0

notgood = [False]*N



# print(AB)



for i in range(N):

    # print("{} start".format(i))

    # print(AB[i])

    if notgood[i]:

        continue

    if len(AB[i]) == 0:

        ans += 1

        continue

    for x in AB[i]:

        # print(H[x], H[i])

        if H[x] > H[i]:

            notgood[i] = True

            break

        elif H[x] == H[i]:

            notgood[x] = True

            notgood[i] = True

            break

        else:

            notgood[x] = True

    else:

        ans += 1

        # print("{} is GOOD!!!".format(i))



print(ans)
def Is(): return list(map(int, input().split()))  # '123 456' -> 123, 456

def LI(): return list(map(int, input().split()))  # '123 456' -> [123, 456]





N, M = Is()

H = LI()

notgood = [False]*N



for i in range(M):

    a, b = Is()

    a -= 1

    b -= 1

    if H[a] > H[b]:

        notgood[b] = True

    elif H[b] > H[a]:

        notgood[a] = True

    else:

        notgood[a] = True

        notgood[b] = True



ans = 0

for i in range(N):

    if not notgood[i]:

        ans += 1



print(ans)
def Is():
    return list(map(int, input().split()))  # '123 456' -> 123, 456


def LI():
    return list(map(int, input().split()))  # '123 456' -> [123, 456]


N, M = Is()
H = LI()
AB = [set() for _ in range(N)]
for i in range(M):
    a, b = Is()
    a -= 1
    b -= 1
    AB[a].add(b)
    AB[b].add(a)
ans = 0
notgood = [False] * N
# print(AB)
for i in range(N):
    # print("{} start".format(i))
    # print(AB[i])
    if notgood[i]:
        continue
    if len(AB[i]) == 0:
        ans += 1
        continue
    for x in AB[i]:
        # print(H[x], H[i])
        if H[x] > H[i]:
            notgood[i] = True
            break
        elif H[x] == H[i]:
            notgood[x] = True
            notgood[i] = True
            break
        else:
            notgood[x] = True
    else:
        ans += 1
        # print("{} is GOOD!!!".format(i))
print(ans)

def Is():
    return list(map(int, input().split()))  # '123 456' -> 123, 456


def LI():
    return list(map(int, input().split()))  # '123 456' -> [123, 456]


N, M = Is()
H = LI()
notgood = [False] * N
for i in range(M):
    a, b = Is()
    a -= 1
    b -= 1
    if H[a] > H[b]:
        notgood[b] = True
    elif H[b] > H[a]:
        notgood[a] = True
    else:
        notgood[a] = True
        notgood[b] = True
ans = 0
for i in range(N):
    if not notgood[i]:
        ans += 1
print(ans)

-AB = [set() for _ in range(N)] +notgood = [False] * N -    AB[a].add(b) -    AB[b].add(a) +    if H[a] > H[b]: +        notgood[b] = True +    elif H[b] > H[a]: +        notgood[a] = True +    else: +        notgood[a] = True +        notgood[b] = True -notgood = [False] * N -# print(AB) -    # print("{} start".format(i)) -    # print(AB[i]) -    if notgood[i]: -        continue -    if len(AB[i]) == 0: +    if not notgood[i]: -        continue -    for x in AB[i]: -        # print(H[x], H[i]) -        if H[x] > H[i]: -            notgood[i] = True -            break -        elif H[x] == H[i]: -            notgood[x] = True -            notgood[i] = True -            break -        else: -            notgood[x] = True -    else: -        ans += 1 -        # print("{} is GOOD!!!".format(i))