def main():

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

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

    A = [0] * n

    for i in range(m):

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

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

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



    cnt = 0



    for i in range(n):

        if A[i] < h[i]:

            cnt += 1



    print(cnt)

    

if __name__ == "__main__":

    main()

def main():

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

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

    ans = [1]*n

    for i in range(m):

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

        if h[a-1] < h[b-1]:

            ans[a-1] = 0

        elif h[a-1] > h[b-1]:

            ans[b-1] = 0

        elif h[a-1] == h[b-1]:

            ans[a-1] = 0

            ans[b-1] = 0

    print((ans.count(1)))





    

    

if __name__ == "__main__":

    main()

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


if __name__ == "__main__":
    main()

def main():
    n, m = list(map(int, input().split()))
    h = list(map(int, input().split()))
    ans = [1] * n
    for i in range(m):
        a, b = list(map(int, input().split()))
        if h[a - 1] < h[b - 1]:
            ans[a - 1] = 0
        elif h[a - 1] > h[b - 1]:
            ans[b - 1] = 0
        elif h[a - 1] == h[b - 1]:
            ans[a - 1] = 0
            ans[b - 1] = 0
    print((ans.count(1)))


if __name__ == "__main__":
    main()

-    A = [0] * n +    ans = [1] * n -        A[a - 1] = max(A[a - 1], h[b - 1]) -        A[b - 1] = max(A[b - 1], h[a - 1]) -    cnt = 0 -    for i in range(n): -        if A[i] < h[i]: -            cnt += 1 -    print(cnt) +        if h[a - 1] < h[b - 1]: +            ans[a - 1] = 0 +        elif h[a - 1] > h[b - 1]: +            ans[b - 1] = 0 +        elif h[a - 1] == h[b - 1]: +            ans[a - 1] = 0 +            ans[b - 1] = 0 +    print((ans.count(1)))