import collections

def f(heights,roads):

	adj = collections.defaultdict(list)

	count = 0

	for u,v in roads:

		adj[u].append(v)

		adj[v].append(u)

	for i,h in enumerate(heights):

		u = i + 1

		if h > max([heights[v-1] for v in adj[u]] or [-1]): count +=1

	return count



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

print(f(list(map(int,input().split(' '))), [list(map(int, input().split(' '))) for _ in range(m)] ))

def f(heights,roads):

	count, r =0, [True] * len(heights)

	for u,v in roads:

		if heights[u-1] <= heights[v-1]: r[u-1] = False

		if heights[u-1] >= heights[v-1]:r[v-1] = False

	for b in r:

		count += 1 if b else 0

	return count



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

print(f(list(map(int,input().split(' '))), [list(map(int, input().split(' '))) for _ in range(m)] ))

import collections


def f(heights, roads):
    adj = collections.defaultdict(list)
    count = 0
    for u, v in roads:
        adj[u].append(v)
        adj[v].append(u)
    for i, h in enumerate(heights):
        u = i + 1
        if h > max([heights[v - 1] for v in adj[u]] or [-1]):
            count += 1
    return count


n, m = list(map(int, input().split(" ")))
print(
    f(
        list(map(int, input().split(" "))),
        [list(map(int, input().split(" "))) for _ in range(m)],
    )
)

def f(heights, roads):
    count, r = 0, [True] * len(heights)
    for u, v in roads:
        if heights[u - 1] <= heights[v - 1]:
            r[u - 1] = False
        if heights[u - 1] >= heights[v - 1]:
            r[v - 1] = False
    for b in r:
        count += 1 if b else 0
    return count


n, m = list(map(int, input().split(" ")))
print(
    f(
        list(map(int, input().split(" "))),
        [list(map(int, input().split(" "))) for _ in range(m)],
    )
)

-import collections - - -    adj = collections.defaultdict(list) -    count = 0 +    count, r = 0, [True] * len(heights) -        adj[u].append(v) -        adj[v].append(u) -    for i, h in enumerate(heights): -        u = i + 1 -        if h > max([heights[v - 1] for v in adj[u]] or [-1]): -            count += 1 +        if heights[u - 1] <= heights[v - 1]: +            r[u - 1] = False +        if heights[u - 1] >= heights[v - 1]: +            r[v - 1] = False +    for b in r: +        count += 1 if b else 0