import sys

import math



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

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

ma = [0] * n

for i in range(m):

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

    ma[a - 1] = max(ma[a-1],h[b - 1])

    ma[b - 1] = max(ma[b-1] ,h[a - 1])

cnt = 0

for i in range(n):

    if h[i] > ma[i]:

        cnt += 1

print(cnt)

import sys

import math

import itertools



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

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

ans = [True] * n

lis = [0] * n

for i in range(m):

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

    lis[a - 1] = max(lis[a - 1], h[b - 1])

    lis[b - 1] = max(lis[b - 1], h[a - 1])

ans = 0

for i in range(n):

    if lis[i] < h [i]:

        ans += 1

print(ans)

import sys
import math

n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ma = [0] * n
for i in range(m):
    a, b = list(map(int, input().split()))
    ma[a - 1] = max(ma[a - 1], h[b - 1])
    ma[b - 1] = max(ma[b - 1], h[a - 1])
cnt = 0
for i in range(n):
    if h[i] > ma[i]:
        cnt += 1
print(cnt)

import sys
import math
import itertools

n, m = list(map(int, input().split()))
h = list(map(int, input().split()))
ans = [True] * n
lis = [0] * n
for i in range(m):
    a, b = list(map(int, input().split()))
    lis[a - 1] = max(lis[a - 1], h[b - 1])
    lis[b - 1] = max(lis[b - 1], h[a - 1])
ans = 0
for i in range(n):
    if lis[i] < h[i]:
        ans += 1
print(ans)

+import itertools -ma = [0] * n +ans = [True] * n +lis = [0] * n -    ma[a - 1] = max(ma[a - 1], h[b - 1]) -    ma[b - 1] = max(ma[b - 1], h[a - 1]) -cnt = 0 +    lis[a - 1] = max(lis[a - 1], h[b - 1]) +    lis[b - 1] = max(lis[b - 1], h[a - 1]) +ans = 0 -    if h[i] > ma[i]: -        cnt += 1 -print(cnt) +    if lis[i] < h[i]: +        ans += 1 +print(ans)