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

ans= 0

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

ds = {}

ok = True

for i in range(m):

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

    if(a in ds):

        ds[a].append(b)

    if(b in ds):

        ds[b].append(a)

    if(a not in ds):

        ds[a] = [b]

    if(b not in ds):

        ds[b] = [a]

for i in range(1, n+1):

    if(i not in ds):

        ans +=1

    else:

        for l in ds[i]:

            if(hs[i-1] <= hs[l-1]):

                ok = False

        if(ok):

            ans +=1

        ok = True

print(ans)

import math

def facts(n):

    ans = []

    for  i in range(1, int(math.sqrt(n)+1)):

        if(n%i==0):

            ans.append(i)

            ans.append(n//i)

    ans = sorted(ans)

    return ans





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

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

state = [1 for i in range(n)]

for i in range(m):

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

    if(hs[a-1]>=hs[b-1]):

        state[b-1] =0

    if(hs[a-1]<= hs[b-1]):

        state[a-1]= 0

ans = 0

for i in range(n):

    if(state[i]==1):

        ans+=1

print(ans)

n, m = list(map(int, input().split()))
ans = 0
hs = list(map(int, input().split()))
ds = {}
ok = True
for i in range(m):
    a, b = list(map(int, input().split()))
    if a in ds:
        ds[a].append(b)
    if b in ds:
        ds[b].append(a)
    if a not in ds:
        ds[a] = [b]
    if b not in ds:
        ds[b] = [a]
for i in range(1, n + 1):
    if i not in ds:
        ans += 1
    else:
        for l in ds[i]:
            if hs[i - 1] <= hs[l - 1]:
                ok = False
        if ok:
            ans += 1
        ok = True
print(ans)

import math


def facts(n):
    ans = []
    for i in range(1, int(math.sqrt(n) + 1)):
        if n % i == 0:
            ans.append(i)
            ans.append(n // i)
    ans = sorted(ans)
    return ans


n, m = list(map(int, input().split()))
hs = list(map(int, input().split()))
state = [1 for i in range(n)]
for i in range(m):
    a, b = list(map(int, input().split()))
    if hs[a - 1] >= hs[b - 1]:
        state[b - 1] = 0
    if hs[a - 1] <= hs[b - 1]:
        state[a - 1] = 0
ans = 0
for i in range(n):
    if state[i] == 1:
        ans += 1
print(ans)

+import math + + +def facts(n): +    ans = [] +    for i in range(1, int(math.sqrt(n) + 1)): +        if n % i == 0: +            ans.append(i) +            ans.append(n // i) +    ans = sorted(ans) +    return ans + + -ans = 0 -ds = {} -ok = True +state = [1 for i in range(n)] -    if a in ds: -        ds[a].append(b) -    if b in ds: -        ds[b].append(a) -    if a not in ds: -        ds[a] = [b] -    if b not in ds: -        ds[b] = [a] -for i in range(1, n + 1): -    if i not in ds: +    if hs[a - 1] >= hs[b - 1]: +        state[b - 1] = 0 +    if hs[a - 1] <= hs[b - 1]: +        state[a - 1] = 0 +ans = 0 +for i in range(n): +    if state[i] == 1: -    else: -        for l in ds[i]: -            if hs[i - 1] <= hs[l - 1]: -                ok = False -        if ok: -            ans += 1 -        ok = True