import copy

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

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



roads = []

for i in range(n): roads.append([])



for i in range(m):

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

    a, b = a-1, b-1

    roads[a].append(b)

    roads[b].append(a)



ans = 0

for i in range(n):

    flg = True

    for j in roads[i]:

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

            flg = False

            break

    if flg: ans += 1



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

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

 

roads = []

for i in range(n): roads.append([])

 

is_good_peak_arr = [True] * n

for i in range(m):

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

    a, b = a-1, b-1

    if h[a] >= h[b]: is_good_peak_arr[b] = False

    if h[b] >= h[a]: is_good_peak_arr[a] = False

 

print((is_good_peak_arr.count(True)))
import copy

n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
roads = []
for i in range(n):
    roads.append([])
for i in range(m):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    roads[a].append(b)
    roads[b].append(a)
ans = 0
for i in range(n):
    flg = True
    for j in roads[i]:
        if h[i] <= h[j]:
            flg = False
            break
    if flg:
        ans += 1
print(ans)

n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
roads = []
for i in range(n):
    roads.append([])
is_good_peak_arr = [True] * n
for i in range(m):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    if h[a] >= h[b]:
        is_good_peak_arr[b] = False
    if h[b] >= h[a]:
        is_good_peak_arr[a] = False
print((is_good_peak_arr.count(True)))

-import copy - +is_good_peak_arr = [True] * n -    roads[a].append(b) -    roads[b].append(a) -ans = 0 -for i in range(n): -    flg = True -    for j in roads[i]: -        if h[i] <= h[j]: -            flg = False -            break -    if flg: -        ans += 1 -print(ans) +    if h[a] >= h[b]: +        is_good_peak_arr[b] = False +    if h[b] >= h[a]: +        is_good_peak_arr[a] = False +print((is_good_peak_arr.count(True)))