#MLE注意！0や1のケースに注意



def main():

    import sys

    input = sys.stdin.readline

    sys.setrecursionlimit(10**7)

    from collections import Counter, deque

    #from collections import defaultdict

    from itertools import combinations, permutations, accumulate, groupby, product

    from bisect import bisect_left,bisect_right

    from heapq import heapify, heappop, heappush

    import math

    #from math import gcd



    #inf = 10**17

    #mod = 10**9 + 7



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

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

    adj = [[] for _ in range(n)] #頂点数, 場合によって変える

    for _ in range(m):

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

        adj[a-1].append(b-1)

        adj[b-1].append(a-1)

    #-1まだ　0負け確　1良い

    check = [-1]*n

    for i in range(n):

        if check[i] == 0:

            continue

        if len(adj[i]) == 0:

            check[i] = 1

        else:

            for j in adj[i]:

                if h[i] < h[j]:

                    check[i] = 0

                    break

                elif h[i] == h[j]:

                    check[i] = 0

                    check[j] = 0

                    break

                else:

                    check[j] = 0

            if check[i] == -1:

                check[i] = 1

    res = 0

    for i in check:

        if i == 1:

            res += 1

    print(res)





if __name__ == '__main__':

    main()

#MLE注意！0や1のケースに注意



def main():

    import sys

    input = sys.stdin.readline

    sys.setrecursionlimit(10**7)

    from collections import Counter, deque

    #from collections import defaultdict

    from itertools import combinations, permutations, accumulate, groupby, product

    from bisect import bisect_left,bisect_right

    from heapq import heapify, heappop, heappush

    import math

    #from math import gcd



    #inf = 10**17

    #mod = 10**9 + 7



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

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

    adj = [[] for _ in range(n)] #頂点数, 場合によって変える

    for _ in range(m):

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

        adj[a-1].append(b-1)

        adj[b-1].append(a-1)

    res = 0

    for i in range(n):

        c = h[i]

        for j in adj[i]:

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

                break

        else:

            res += 1

    print(res)







if __name__ == '__main__':

    main()
# MLE注意！0や1のケースに注意
def main():
    import sys

    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque

    # from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left, bisect_right
    from heapq import heapify, heappop, heappush
    import math

    # from math import gcd
    # inf = 10**17
    # mod = 10**9 + 7
    n, m = list(map(int, input().split()))
    h = list(map(int, input().split()))
    adj = [[] for _ in range(n)]  # 頂点数, 場合によって変える
    for _ in range(m):
        a, b = list(map(int, input().split()))
        adj[a - 1].append(b - 1)
        adj[b - 1].append(a - 1)
    # -1まだ　0負け確　1良い
    check = [-1] * n
    for i in range(n):
        if check[i] == 0:
            continue
        if len(adj[i]) == 0:
            check[i] = 1
        else:
            for j in adj[i]:
                if h[i] < h[j]:
                    check[i] = 0
                    break
                elif h[i] == h[j]:
                    check[i] = 0
                    check[j] = 0
                    break
                else:
                    check[j] = 0
            if check[i] == -1:
                check[i] = 1
    res = 0
    for i in check:
        if i == 1:
            res += 1
    print(res)


if __name__ == "__main__":
    main()

# MLE注意！0や1のケースに注意
def main():
    import sys

    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque

    # from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left, bisect_right
    from heapq import heapify, heappop, heappush
    import math

    # from math import gcd
    # inf = 10**17
    # mod = 10**9 + 7
    n, m = list(map(int, input().split()))
    h = list(map(int, input().split()))
    adj = [[] for _ in range(n)]  # 頂点数, 場合によって変える
    for _ in range(m):
        a, b = list(map(int, input().split()))
        adj[a - 1].append(b - 1)
        adj[b - 1].append(a - 1)
    res = 0
    for i in range(n):
        c = h[i]
        for j in adj[i]:
            if h[i] <= h[j]:
                break
        else:
            res += 1
    print(res)


if __name__ == "__main__":
    main()

-    # -1まだ　0負け確　1良い -    check = [-1] * n +    res = 0 -        if check[i] == 0: -            continue -        if len(adj[i]) == 0: -            check[i] = 1 +        c = h[i] +        for j in adj[i]: +            if h[i] <= h[j]: +                break -            for j in adj[i]: -                if h[i] < h[j]: -                    check[i] = 0 -                    break -                elif h[i] == h[j]: -                    check[i] = 0 -                    check[j] = 0 -                    break -                else: -                    check[j] = 0 -            if check[i] == -1: -                check[i] = 1 -    res = 0 -    for i in check: -        if i == 1: