def main():

    n, m = [int(x) for x in input().split()]

    heights = tuple(int(x) for x in input().split())

    adjacents_heights = [set() for _ in range(n)]

    for i in range(m):

        a, b = [int(x) - 1 for x in input().split()]

        adjacents_heights[a].add(heights[b])

        adjacents_heights[b].add(heights[a])

    ans = 0

    for h, ahs in zip(heights, adjacents_heights):

        if not ahs:

            ans += 1

            continue

        elif h > max(ahs):

            ans += 1



    return ans





if __name__ == '__main__':

    print((main()))

def main():

    n, m = [int(x) for x in input().split()]

    heights = tuple(int(x) for x in input().split())

    checked = [1] * n

    for i in range(m):

        a, b = [int(x) - 1 for x in input().split()]

        h_a = heights[a]

        h_b = heights[b]

        if h_a < h_b:

            checked[a] = 0

        elif h_a > h_b:

            checked[b] = 0

        else:

            checked[a] = 0

            checked[b] = 0



    return sum(checked)





if __name__ == '__main__':

    print((main()))

def main():
    n, m = [int(x) for x in input().split()]
    heights = tuple(int(x) for x in input().split())
    adjacents_heights = [set() for _ in range(n)]
    for i in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        adjacents_heights[a].add(heights[b])
        adjacents_heights[b].add(heights[a])
    ans = 0
    for h, ahs in zip(heights, adjacents_heights):
        if not ahs:
            ans += 1
            continue
        elif h > max(ahs):
            ans += 1
    return ans


if __name__ == "__main__":
    print((main()))

def main():
    n, m = [int(x) for x in input().split()]
    heights = tuple(int(x) for x in input().split())
    checked = [1] * n
    for i in range(m):
        a, b = [int(x) - 1 for x in input().split()]
        h_a = heights[a]
        h_b = heights[b]
        if h_a < h_b:
            checked[a] = 0
        elif h_a > h_b:
            checked[b] = 0
        else:
            checked[a] = 0
            checked[b] = 0
    return sum(checked)


if __name__ == "__main__":
    print((main()))

-    adjacents_heights = [set() for _ in range(n)] +    checked = [1] * n -        adjacents_heights[a].add(heights[b]) -        adjacents_heights[b].add(heights[a]) -    ans = 0 -    for h, ahs in zip(heights, adjacents_heights): -        if not ahs: -            ans += 1 -            continue -        elif h > max(ahs): -            ans += 1 -    return ans +        h_a = heights[a] +        h_b = heights[b] +        if h_a < h_b: +            checked[a] = 0 +        elif h_a > h_b: +            checked[b] = 0 +        else: +            checked[a] = 0 +            checked[b] = 0 +    return sum(checked)