

import copy

from sys import stdin

input = stdin.readline



n,m = list(map(int,input().split()))

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

p = copy.copy(h)

# path = list(list(map(int,input().split())) for x in range(m))

for i in range(m):

    x,y = list(map(int,input().split()))

    if h[x-1] > h[y-1]:

        p[y-1] = 0

    elif h[x-1] < h[y-1]:

        p[x -1] = 0

    elif  h[x-1] == h[y-1]:

        p[y-1] = 0

        p[x-1] = 0

cnt = 0

for k in p:

    if k != 0:

        cnt += 1

# print(h)

print(cnt)


# import copy

from sys import stdin

input = stdin.readline



n,m = list(map(int,input().split()))

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

# p = copy.copy(h)

p = [0]*n

# path = list(list(map(int,input().split())) for x in range(m))

for i in range(m):

    x,y = list(map(int,input().split()))

    if h[x-1] > h[y-1]:

        p[y-1] = 1

    elif h[x-1] < h[y-1]:

        p[x -1] = 1

    elif  h[x-1] == h[y-1]:

        p[y-1] = 1

        p[x-1] = 1





print((p.count(0)))
import copy
from sys import stdin

input = stdin.readline
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
p = copy.copy(h)
# path = list(list(map(int,input().split())) for x in range(m))
for i in range(m):
    x, y = list(map(int, input().split()))
    if h[x - 1] > h[y - 1]:
        p[y - 1] = 0
    elif h[x - 1] < h[y - 1]:
        p[x - 1] = 0
    elif h[x - 1] == h[y - 1]:
        p[y - 1] = 0
        p[x - 1] = 0
cnt = 0
for k in p:
    if k != 0:
        cnt += 1
# print(h)
print(cnt)

# import copy
from sys import stdin

input = stdin.readline
n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
# p = copy.copy(h)
p = [0] * n
# path = list(list(map(int,input().split())) for x in range(m))
for i in range(m):
    x, y = list(map(int, input().split()))
    if h[x - 1] > h[y - 1]:
        p[y - 1] = 1
    elif h[x - 1] < h[y - 1]:
        p[x - 1] = 1
    elif h[x - 1] == h[y - 1]:
        p[y - 1] = 1
        p[x - 1] = 1
print((p.count(0)))

-import copy +# import copy -p = copy.copy(h) +# p = copy.copy(h) +p = [0] * n -        p[y - 1] = 0 +        p[y - 1] = 1 -        p[x - 1] = 0 +        p[x - 1] = 1 -        p[y - 1] = 0 -        p[x - 1] = 0 -cnt = 0 -for k in p: -    if k != 0: -        cnt += 1 -# print(h) -print(cnt) +        p[y - 1] = 1 +        p[x - 1] = 1 +print((p.count(0)))