#展望台i：1 ~ Nこの展望台

#Hi: 展望台iの高さ



from copy import deepcopy

from pprint import pprint



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



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



anslist = [1]*n



for _ in range(m):

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

    

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

        anslist[b-1] = 0

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

        anslist[a-1] = 0

    elif h[a-1] == h[b-1]:

        anslist[a-1] = 0

        anslist[b-1] = 0

    #print(anslist)





print((anslist.count(1)))



exit()
#展望台i：1 ~ Nこの展望台

#Hi: 展望台iの高さ



from copy import deepcopy

from pprint import pprint



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



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



nolist = [0] * n



for _ in range(m):

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

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

        nolist[b-1] = 1

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

        nolist[a-1] = 1

    elif h[a-1] == h[b-1]:

        nolist[a-1] = 1

        nolist[b-1] = 1



#counter = 0

#for j in range(n):

#    if maxlist[j] ==j and pairlist[j] != 1:

#        counter += 1



#print(maxlist)

#print(pairlist)



print((nolist.count(0)))



exit()
# 展望台i：1 ~ Nこの展望台
# Hi: 展望台iの高さ
from copy import deepcopy
from pprint import pprint

n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
anslist = [1] * n
for _ in range(m):
    a, b = list(map(int, input().split()))
    if h[a - 1] > h[b - 1]:
        anslist[b - 1] = 0
    elif h[a - 1] < h[b - 1]:
        anslist[a - 1] = 0
    elif h[a - 1] == h[b - 1]:
        anslist[a - 1] = 0
        anslist[b - 1] = 0
    # print(anslist)
print((anslist.count(1)))
exit()

# 展望台i：1 ~ Nこの展望台
# Hi: 展望台iの高さ
from copy import deepcopy
from pprint import pprint

n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
nolist = [0] * n
for _ in range(m):
    a, b = list(map(int, input().split()))
    if h[a - 1] > h[b - 1]:
        nolist[b - 1] = 1
    elif h[a - 1] < h[b - 1]:
        nolist[a - 1] = 1
    elif h[a - 1] == h[b - 1]:
        nolist[a - 1] = 1
        nolist[b - 1] = 1
# counter = 0
# for j in range(n):
#    if maxlist[j] ==j and pairlist[j] != 1:
#        counter += 1
# print(maxlist)
# print(pairlist)
print((nolist.count(0)))
exit()

-anslist = [1] * n +nolist = [0] * n -        anslist[b - 1] = 0 +        nolist[b - 1] = 1 -        anslist[a - 1] = 0 +        nolist[a - 1] = 1 -        anslist[a - 1] = 0 -        anslist[b - 1] = 0 -    # print(anslist) -print((anslist.count(1))) +        nolist[a - 1] = 1 +        nolist[b - 1] = 1 +# counter = 0 +# for j in range(n): +#    if maxlist[j] ==j and pairlist[j] != 1: +#        counter += 1 +# print(maxlist) +# print(pairlist) +print((nolist.count(0)))